Beispiel #1
0
def test_method_decl():
    clazz = Clazz("test.hpp", "", "MyClass")
    method = Method("myMethod", "void", "MyClass")
    ignored_method = Method("", "", "")
    ignored_method.ignored = True
    exporter = CythonDeclarationExporter(Includes(), Config())
    exporter.visit_param(Param("myParam", "double"))
    exporter.visit_method(method)
    exporter.visit_method(ignored_method)
    exporter.visit_clazz(clazz)
    exporter.visit_ast(None)
    decl = exporter.export()
    assert_multi_line_equal(
        decl.strip(),
        lines(
            "cdef extern from \"test.hpp\" namespace \"\":",
            "    cdef cppclass MyClass:",
            "        void myMethod(double myParam) except +"
        )
    )
def test_method_decl():
    clazz = Clazz("test.hpp", "", "MyClass")
    method = Method("myMethod", "void", "MyClass")
    ignored_method = Method("", "", "")
    ignored_method.ignored = True
    exporter = CythonDeclarationExporter(Includes(), Config())
    exporter.visit_param(Param("myParam", "double"))
    exporter.visit_method(method)
    exporter.visit_method(ignored_method)
    exporter.visit_clazz(clazz)
    exporter.visit_ast(None)
    decl = exporter.export()
    assert_multi_line_equal(
        decl.strip(),
        lines(
            "cdef extern from \"test.hpp\" namespace \"\":",
            "    cdef cppclass MyClass:",
            "        void myMethod(double myParam) except +"
        )
    )