Skip to content
Snippets Groups Projects
Commit 8e684d8f authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Fix error message of CBackend for unsupported nodes

parent f4cbf057
Branches
Tags
1 merge request!27Fix error message of CBackend for unsupported nodes
......@@ -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% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment