Skip to content

Implement of custom child list #86

Implement of custom child list

Implement of custom child list #86

GitHub Actions / Unit Test Report failed Aug 12, 2024 in 0s

536 tests run, 511 passed, 24 skipped, 1 failed.

Annotations

Check failure on line 253 in src/sgl/device/tests/test_declrefs.py

See this annotation in the file changed.

@github-actions github-actions / Unit Test Report

test_declrefs.test_function_with_int_params[DeviceType.vulkan]

TypeError: Unable to convert function return value to a Python type! The signature was
    (self) -> sgl::FunctionReflectionParameterList
Raw output
device_type = DeviceType.vulkan

    @pytest.mark.parametrize("device_type", DEVICES)
    def test_function_with_int_params(device_type):
        device = helpers.get_device(type=device_type)
    
        module = device.load_module_from_source(
            "test_function_with_int_params",
            r"""
    int foo(int a, float b) {
        return 0;
    }
    """,
        )
    
        # Get function.
        func_node = module.module_decl.find_first_child_of_kind(
            sgl.DeclReflection.Kind.func, "foo"
        )
        params = func_node.children_of_kind(sgl.DeclReflection.Kind.variable)
        assert len(func_node) == 2
        assert len(params) == 2
    
        # Verify first parameter.
        assert params[0].kind == sgl.DeclReflection.Kind.variable
        assert params[0].name == "a"
    
        # Verify second parameter.
        assert params[1].kind == sgl.DeclReflection.Kind.variable
        assert params[1].name == "b"
    
        # Verify first parameter through search.
        p = func_node.find_first_child_of_kind(sgl.DeclReflection.Kind.variable, "a")
        assert p is not None
        assert p.kind == sgl.DeclReflection.Kind.variable
        assert p.name == "a"
    
        # Verify second parameter through search.
        p = func_node.find_first_child_of_kind(sgl.DeclReflection.Kind.variable, "b")
        assert p is not None
        assert p.kind == sgl.DeclReflection.Kind.variable
        assert p.name == "b"
    
        # Get function reflection info and verify its return type and parameters.
        func_reflection = func_node.as_function()
        assert func_reflection.return_type.kind == sgl.TypeReflection.Kind.scalar
        assert func_reflection.return_type.name == "int"
>       assert len(func_reflection.parameters) == 2
E       TypeError: Unable to convert function return value to a Python type! The signature was
E           (self) -> sgl::FunctionReflectionParameterList

src/sgl/device/tests/test_declrefs.py:253: TypeError