Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
8e684d8f
Commit
8e684d8f
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Fix error message of CBackend for unsupported nodes
parent
f4cbf057
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!27
Fix error message of CBackend for unsupported nodes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils/backends/cbackend.py
+1
-1
1 addition, 1 deletion
pystencils/backends/cbackend.py
pystencils_tests/test_print_unsupported_node.py
+32
-0
32 additions, 0 deletions
pystencils_tests/test_print_unsupported_node.py
with
33 additions
and
1 deletion
pystencils/backends/cbackend.py
+
1
−
1
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
()]
...
...
This diff is collapsed.
Click to expand it.
pystencils_tests/test_print_unsupported_node.py
0 → 100644
+
32
−
0
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment