diff --git a/wren-core-py/src/remote_functions.rs b/wren-core-py/src/remote_functions.rs index f7980fca6..552b94242 100644 --- a/wren-core-py/src/remote_functions.rs +++ b/wren-core-py/src/remote_functions.rs @@ -25,13 +25,19 @@ use wren_core::mdl::function::FunctionType; #[pyclass(name = "RemoteFunction")] #[derive(Serialize, Deserialize, Clone)] pub struct PyRemoteFunction { + #[pyo3(get)] pub function_type: String, + #[pyo3(get)] pub name: String, + #[pyo3(get)] pub return_type: Option, /// It's a comma separated string of parameter names + #[pyo3(get)] pub param_names: Option, /// It's a comma separated string of parameter types + #[pyo3(get)] pub param_types: Option, + #[pyo3(get)] pub description: Option, } diff --git a/wren-core-py/tests/test_modeling_core.py b/wren-core-py/tests/test_modeling_core.py index 880a6d290..23b4bc21d 100644 --- a/wren-core-py/tests/test_modeling_core.py +++ b/wren-core-py/tests/test_modeling_core.py @@ -123,19 +123,19 @@ def test_read_function_list(): def test_get_available_functions(): session_context = SessionContext(manifest_str, "tests/functions.csv") functions = session_context.get_available_functions() - add_two = next(x.to_dict() for x in functions if x["name"] == "add_two") - assert add_two["name"] == "add_two" - assert add_two["function_type"] == "scalar" - assert add_two["description"] == "Adds two numbers together." - assert add_two["return_type"] == "int" - assert add_two["param_names"] == "f1,f2" - assert add_two["param_types"] == "int,int" - - max_if = next(x.to_dict() for x in functions if x["name"] == "max_if") - assert max_if["name"] == "max_if" - assert max_if["function_type"] == "window" - assert max_if["param_names"] is None - assert max_if["param_types"] is None + add_two = next(f for f in functions if f.name == "add_two") + assert add_two.name == "add_two" + assert add_two.function_type == "scalar" + assert add_two.description == "Adds two numbers together." + assert add_two.return_type == "int" + assert add_two.param_names == "f1,f2" + assert add_two.param_types == "int,int" + + max_if = next(f for f in functions if f.name == "max_if") + assert max_if.name == "max_if" + assert max_if.function_type == "window" + assert max_if.param_names is None + assert max_if.param_types is None @pytest.mark.parametrize(