()
| 36 | |
| 37 | |
| 38 | def test_error_from_cxx() -> None: |
| 39 | test_raise_error = tvm_ffi.get_global_func("testing.test_raise_error") |
| 40 | |
| 41 | try: |
| 42 | test_raise_error("ValueError", "error XYZ") |
| 43 | except ValueError as e: |
| 44 | assert e.__tvm_ffi_error__.kind == "ValueError" # ty: ignore[unresolved-attribute] |
| 45 | assert e.__tvm_ffi_error__.message == "error XYZ" # ty: ignore[unresolved-attribute] |
| 46 | assert e.__tvm_ffi_error__.backtrace.find("TestRaiseError") != -1 # ty: ignore[unresolved-attribute] |
| 47 | |
| 48 | fapply = tvm_ffi.convert(lambda f, *args: f(*args)) |
| 49 | |
| 50 | with pytest.raises(TypeError): |
| 51 | fapply(test_raise_error, "TypeError", "error XYZ") |
| 52 | |
| 53 | # wrong number of arguments |
| 54 | with pytest.raises(TypeError): |
| 55 | tvm_ffi.convert(lambda x: x)() |
| 56 | |
| 57 | |
| 58 | def test_error_from_nested_pyfunc() -> None: |
nothing calls this directly
no test coverage detected