Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrik committed Aug 2, 2023
1 parent 3073175 commit 1457a57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mypy/stubgenc.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,14 @@ def generate_function_stub(
The 'class_name' is used to find signature of __init__ or __new__ in
'class_sigs'.
"""
docstr: Any = getattr(obj, "__doc__", None)
if not isinstance(docstr, str):
docstr = None

ctx = FunctionContext(
self.module_name,
name,
docstr=getattr(obj, "__doc__", None),
docstr=docstr,
is_abstract=self.is_abstract_method(obj),
class_info=class_info,
)
Expand Down
2 changes: 1 addition & 1 deletion mypy/test/teststubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ def test(arg0: str) -> None:
mod = ModuleType(self.__module__, "")
gen = InspectionStubGenerator(mod.__name__, known_modules=[mod.__name__], module=mod)
gen.generate_function_stub("test", test, output=output)
assert_equal(output, ["def test(*args, **kwargs) -> Any: ..."])
assert_equal(output, ["def test(*args, **kwargs): ..."])
assert_equal(gen.get_imports().splitlines(), [])

def test_generate_c_property_with_pybind11(self) -> None:
Expand Down

0 comments on commit 1457a57

Please sign in to comment.