8000 Namespace packages (PEP 420) by gvanrossum · Pull Request #5691 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Namespace packages (PEP 420) #5691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 3, 2018
Prev Previous commit
Next Next commit
Add reveal_type() calls to tests
  • Loading branch information
Guido van Rossum committed Oct 1, 2018
commit 2da72cc57bf1994a6a5bd801e0f6470310686ae5
7 changes: 7 additions & 0 deletions test-data/unit/check-modules.test
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,7 @@ def __radd__(self) -> int: ...
def __iadd__(self) -> int: ...

-- Tests for PEP 420 namespace packages.

[case testClassicPackage]
from foo.bar import x
[file foo/__init__.py]
Expand All @@ -2546,6 +2547,7 @@ main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports"
[case testNamespacePackage]
# flags: --namespace-packages
from foo.bar import x
reveal_type(x) # E: Revealed type is 'builtins.int'
[file foo/bar.py]
x = 0

Expand All @@ -2554,6 +2556,9 @@ x = 0
from foo.bax import x
from foo.bay import y
from foo.baz import z
reveal_type(x) # E: Revealed type is 'builtins.int'
reveal_type(y) # E: Revealed type is 'builtins.int'
reveal_type(z) # E: Revealed type is 'builtins.int'
[file xx/foo/bax.py]
x = 0
[file yy/foo/bay.py]
Expand All @@ -2567,7 +2572,9 @@ mypy_path = tmp/xx, tmp/yy
[case testClassicPackageIgnoresEarlierNamespacePackage]
# flags: --namespace-packages --config-file tmp/mypy.ini
from foo.bar import y
reveal_type(y) # E: Revealed type is 'builtins.int'
[file xx/foo/bar.py]
x = ''
[file yy/foo/bar.py]
y = 0
[file yy/foo/__init__.py]
Expand Down
0