import pytest from phasm.type5.solver import Type5SolverException from ..helpers import Suite @pytest.mark.integration_test def test_call_nullary(): code_py = """ def helper() -> i32: return 3 @exported def testEntry() -> i32: return helper() """ result = Suite(code_py).run_code() assert 3 == result.returned_value @pytest.mark.integration_test def test_call_pre_defined(): code_py = """ def helper(left: i32) -> i32: return left @exported def testEntry() -> i32: return helper(13) """ result = Suite(code_py).run_code() assert 13 == result.returned_value @pytest.mark.integration_test def test_call_post_defined(): code_py = """ @exported def testEntry() -> i32: return helper(13) def helper(left: i32) -> i32: return left """ result = Suite(code_py).run_code() assert 13 == result.returned_value @pytest.mark.integration_test def test_call_invalid_type(): code_py = """ def helper(left: i32) -> i32: return left() """ with pytest.raises(Type5SolverException, match=r'i32 ~ Callable\[i32\]'): Suite(code_py).run_code()