Commit 8e684d8f authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Fix error message of CBackend for unsupported nodes

parent f4cbf057
......@@ -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), for s in node.get_parameters()]
# -*- coding: utf-8 -*-
# Copyright © 2019 Stephan Seitz <>
# 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):
def test_print_unsupported_node():
with pytest.raises(NotImplementedError, match='CBackend does not support node of type UnsupportedNode'):
def main():
if __name__ == '__main__':
Markdown is supported
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