diff --git a/packages/python-packages/api-stub-generator/tests/class_parsing_test.py b/packages/python-packages/api-stub-generator/tests/class_parsing_test.py index a5b81680e1a..815b2a95f6f 100644 --- a/packages/python-packages/api-stub-generator/tests/class_parsing_test.py +++ b/packages/python-packages/api-stub-generator/tests/class_parsing_test.py @@ -110,9 +110,9 @@ def test_overloads(self): assert node1.name == "double" self._check_arg_nodes(node1.args, [ ("self", None, None), - ("input", "Optional[int]", "1"), + ("input", "int", "1"), ("*", None, None), - ("test", "Optional[bool]", "False"), + ("test", "bool", "False"), ("**kwargs", None, None) ]) assert node1.return_type == "int" @@ -122,9 +122,9 @@ def test_overloads(self): assert node2.name == "double" self._check_arg_nodes(node2.args, [ ("self", None, None), - ("input", "Optional[Sequence[int]]", "[1]"), + ("input", "Sequence[int]", "[1]"), ("*", None, None), - ("test", "Optional[bool]", "False"), + ("test", "bool", "False"), ("**kwargs", None, None) ]) assert node2.return_type == "list[int]" @@ -138,7 +138,7 @@ def test_overloads(self): # don't appear in the actual APIView. ("input", "int | collections.abc.Sequence[int]", None), ("*", None, None), - ("test", "Optional[bool]", "False"), + ("test", "bool", "False"), ("**kwargs", None, None) ]) assert node3.return_type == "int | list[int]" diff --git a/packages/python-packages/api-stub-generator/tests/function_parsing_test.py b/packages/python-packages/api-stub-generator/tests/function_parsing_test.py index 04f01d90381..98e673fe692 100644 --- a/packages/python-packages/api-stub-generator/tests/function_parsing_test.py +++ b/packages/python-packages/api-stub-generator/tests/function_parsing_test.py @@ -107,7 +107,7 @@ def test_complex_typehints(self): def test_non_typehint_with_string_defaults(self): - func_node = FunctionNode("test", None, TypeHintingClient.some_method_non_optional, "test") + func_node = FunctionNode("test", None, obj=TypeHintingClient.some_method_non_optional) arg1 = func_node.args["docstring_type"] assert arg1.argtype == "str" assert arg1.default == "string" @@ -115,7 +115,7 @@ def test_non_typehint_with_string_defaults(self): assert arg2.argtype == "str" assert arg2.default == "string" - func_node = FunctionNode("test", None, TypeHintingClient.some_method_with_optionals, "test") + func_node = FunctionNode("test", None, obj=TypeHintingClient.some_method_with_optionals) arg1 = func_node.args["labeled_optional"] assert arg1.argtype == "Optional[str]" assert arg1.default == "string" diff --git a/packages/python-packages/apistubgentest/apistubgentest/models/_models.py b/packages/python-packages/apistubgentest/apistubgentest/models/_models.py index 94fa3d0bf4c..7773023ed84 100644 --- a/packages/python-packages/apistubgentest/apistubgentest/models/_models.py +++ b/packages/python-packages/apistubgentest/apistubgentest/models/_models.py @@ -184,7 +184,7 @@ def double(self, input: int = 1, *, test: bool = False, **kwargs) -> int: def double(self, input: Sequence[int] = [1], *, test: bool = False, **kwargs) -> list[int]: ... - async def double(self, input: int | Sequence[int], *, test: bool = False, **kwargs) -> int | list[int]: + def double(self, input: int | Sequence[int], *, test: bool = False, **kwargs) -> int | list[int]: if isinstance(input, Sequence): return [i * 2 for i in input] return input * 2