Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
8e684d8f
Commit
8e684d8f
authored
Aug 12, 2019
by
Stephan Seitz
Browse files
Fix error message of CBackend for unsupported nodes
parent
f4cbf057
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/backends/cbackend.py
View file @
8e684d8f
...
...
@@ -169,7 +169,7 @@ class CBackend:
method_name
=
"_print_"
+
cls
.
__name__
if
hasattr
(
self
,
method_name
):
return
getattr
(
self
,
method_name
)(
node
)
raise
NotImplementedError
(
self
.
__class__
+
" does not support node of type "
+
str
(
type
(
node
))
)
raise
NotImplementedError
(
self
.
__class__
.
__name__
+
" does not support node of type "
+
node
.
__class__
.
__name__
)
def
_print_KernelFunction
(
self
,
node
):
function_arguments
=
[
"%s %s"
%
(
str
(
s
.
symbol
.
dtype
),
s
.
symbol
.
name
)
for
s
in
node
.
get_parameters
()]
...
...
pystencils_tests/test_print_unsupported_node.py
0 → 100644
View file @
8e684d8f
# -*- coding: utf-8 -*-
#
# Copyright © 2019 Stephan Seitz <stephan.seitz@fau.de>
#
# Distributed under terms of the GPLv3 license.
"""
"""
import
pytest
import
pystencils
from
pystencils.backends.cbackend
import
CBackend
class
UnsupportedNode
(
pystencils
.
astnodes
.
Node
):
def
__init__
(
self
):
super
().
__init__
()
def
test_print_unsupported_node
():
with
pytest
.
raises
(
NotImplementedError
,
match
=
'CBackend does not support node of type UnsupportedNode'
):
CBackend
()(
UnsupportedNode
())
def
main
():
test_print_unsupported_node
()
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment