Skip to content

Commit

Permalink
fix(#753): API documentation for unittest.mock (#754)
Browse files Browse the repository at this point in the history
* fix(#753): add failing test

Signed-off-by: Bryant Finney <bryant.finney@outlook.com>

* fix(#753): avoid `TypeError`s

... by checking for the `__contains__` attribute

Signed-off-by: Bryant Finney <bryant.finney@outlook.com>

* fix(#753): Apply suggestion

... from @mhils during #754

Signed-off-by: Bryant Finney <bryant.finney@outlook.com>

---------

Signed-off-by: Bryant Finney <bryant.finney@outlook.com>
  • Loading branch information
bryant-finney authored Oct 23, 2024
1 parent 5a8fdc1 commit d44d4f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pdoc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def _taken_from(self, member_name: str, obj: Any) -> tuple[str, str]:

mod = _safe_getattr(obj, "__module__", None)
qual = _safe_getattr(obj, "__qualname__", None)
if mod and qual and "<locals>" not in qual:
if mod and isinstance(qual, str) and "<locals>" not in qual:
return mod, qual
else:
# This might be wrong, but it's the best guess we have.
Expand Down
2 changes: 1 addition & 1 deletion test/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
m.name
for m in pkgutil.iter_modules()
if not m.name.startswith("_") and m.name not in ("test", "idlelib", "py")
]
] + ["unittest.mock"]


@pytest.mark.slow
Expand Down

0 comments on commit d44d4f8

Please sign in to comment.