Skip to content

Commit

Permalink
Only test the contents of __all__, not the presence
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Jul 31, 2022
1 parent 2f06a77 commit 02b4f14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mypy/stubtest.py
Expand Up @@ -316,7 +316,7 @@ def _belongs_to_runtime(r: types.ModuleType, attr: str) -> bool:
return not isinstance(obj, types.ModuleType)

runtime_public_contents = (
runtime_all_as_set | {"__all__"}
runtime_all_as_set
if runtime_all_as_set is not None
else {
m
Expand Down
4 changes: 2 additions & 2 deletions mypy/test/teststubtest.py
Expand Up @@ -934,7 +934,7 @@ def test_all_at_runtime_not_stub(self) -> Iterator[Case]:
runtime="""
__all__ = []
Z = 5""",
error="__all__",
error=None,
)

@collect_cases
Expand Down Expand Up @@ -974,7 +974,7 @@ def h(x: str): ...
runtime="",
error="h",
)
yield Case(stub="", runtime="__all__ = []", error="__all__") # dummy case
yield Case(stub="", runtime="__all__ = []", error=None) # dummy case
yield Case(stub="", runtime="__all__ += ['y']\ny = 5", error="y")
yield Case(stub="", runtime="__all__ += ['g']\ndef g(): pass", error="g")
# Here we should only check that runtime has B, since the stub explicitly re-exports it
Expand Down

0 comments on commit 02b4f14

Please sign in to comment.