Skip to content

Commit

Permalink
Fix Pandas ghostwriting
Browse files Browse the repository at this point in the history
Because they don't define __all__ and have some mocks as default values.
  • Loading branch information
Zac-HD committed Apr 17, 2021
1 parent fbd2985 commit 6ec2501
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hypothesis-python/src/hypothesis/extra/ghostwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def _valid_syntax_repr(strategy):
# .filter(), and .flatmap() to work without NameError
imports = {i for i in _imports_for_strategy(strategy) if i[1] in r}
return imports, r
except (SyntaxError, InvalidArgument):
except (SyntaxError, RecursionError, InvalidArgument):
return set(), "nothing()"


Expand Down Expand Up @@ -684,9 +684,12 @@ def magic(
v
for k, v in vars(thing).items()
if callable(v)
and (getattr(v, "__module__", pkg) == pkg or not pkg)
and not is_mock(v)
and ((not pkg) or getattr(v, "__module__", pkg).startswith(pkg))
and not k.startswith("_")
]
if pkg and any(getattr(f, "__module__", pkg) == pkg for f in funcs):
funcs = [f for f in funcs if getattr(f, "__module__", pkg) == pkg]
for f in funcs:
try:
if (
Expand Down

0 comments on commit 6ec2501

Please sign in to comment.