Skip to content
Snippets Groups Projects
Commit 83597528 authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'fix-unsupported-nodes-error-message' into 'master'

Fix error message of CBackend for unsupported nodes

See merge request !27
parents dbf26cc8 8e684d8f
Branches
Tags
No related merge requests found
......@@ -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()]
......
# -*- 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()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment