@@ -34,3 +34,48 @@ def test_endpoint_docstring_unwraps_python_code_return_string(env) -> None:
3434
3535 assert "MyModel | None" in result
3636 assert "object at 0x" not in result
37+
38+
39+ def test_endpoint_arguments_multi_body_required (env ) -> None :
40+ template = env .get_template ("endpoint_macros.py.jinja" )
41+ body1 = SimpleNamespace (
42+ prop = SimpleNamespace (required = True , get_type_string = lambda no_optional = False : PythonCode ("ItemA" ))
43+ )
44+ body2 = SimpleNamespace (
45+ prop = SimpleNamespace (required = True , get_type_string = lambda no_optional = False : PythonCode ("ItemB" ))
46+ )
47+ endpoint = SimpleNamespace (
48+ path_parameters = [],
49+ query_parameters = [],
50+ header_parameters = [],
51+ cookie_parameters = [],
52+ requires_security = False ,
53+ bodies = [body1 , body2 ],
54+ list_all_parameters = lambda : [body1 .prop , body2 .prop ],
55+ )
56+
57+ result = template .module .arguments (endpoint , include_client = False )
58+ assert "Unset" not in result
59+ assert "UNSET" not in result
60+
61+
62+ def test_endpoint_arguments_multi_body_optional (env ) -> None :
63+ template = env .get_template ("endpoint_macros.py.jinja" )
64+ body1 = SimpleNamespace (
65+ prop = SimpleNamespace (required = True , get_type_string = lambda no_optional = False : PythonCode ("ItemA" ))
66+ )
67+ body2 = SimpleNamespace (
68+ prop = SimpleNamespace (required = False , get_type_string = lambda no_optional = False : PythonCode ("ItemB" ))
69+ )
70+ endpoint = SimpleNamespace (
71+ path_parameters = [],
72+ query_parameters = [],
73+ header_parameters = [],
74+ cookie_parameters = [],
75+ requires_security = False ,
76+ bodies = [body1 , body2 ],
77+ list_all_parameters = lambda : [body1 .prop , body2 .prop ],
78+ )
79+
80+ result = template .module .arguments (endpoint , include_client = False )
81+ assert "| Unset = UNSET" in result
0 commit comments