blob: 521db0833e6e879d6a5181e31a086cddb08ec9ae [file] [log] [blame] [edit]
-- Type checker test cases dealing with modules and imports on case-insensitive filesystems.
[case testCaseSensitivityDir]
from a import B # E: Module 'a' has no attribute 'B'
[file a/__init__.py]
[file a/b/__init__.py]
[case testCaseInsensitivityDir]
# flags: --config-file tmp/mypy.ini
from a import B # E: Module 'a' has no attribute 'B'
from other import x
reveal_type(x) # N: Revealed type is 'builtins.int'
[file a/__init__.py]
[file a/b/__init__.py]
[file FuNkY_CaSe/other.py]
x = 1
[file mypy.ini]
\[mypy]
mypy_path = tmp/funky_case
[case testPreferPackageOverFileCase]
# flags: --config-file tmp/mypy.ini
import a
[file funky/a.py]
/ # Deliberate syntax error, this file should not be parsed.
[file FuNkY/a/__init__.py]
pass
[file mypy.ini]
\[mypy]
mypy_path = tmp/funky
[case testNotPreferPackageOverFileCase]
import a
[file a.py]
'no'() # E: "str" not callable
[file A/__init__.py]
/ # Deliberate syntax error, this file should not be parsed.
[case testNamespacePackagePickFirstOnMypyPathCase]
# flags: --namespace-packages --config-file tmp/mypy.ini
from foo.bar import x
reveal_type(x) # N: Revealed type is 'builtins.int'
[file XX/foo/bar.py]
x = 0
[file yy/foo/bar.py]
x = ''
[file mypy.ini]
\[mypy]
mypy_path = tmp/xx, tmp/yy
[case testClassicPackageInsideNamespacePackageCase]
# flags: --namespace-packages --config-file tmp/mypy.ini
from foo.bar.baz.boo import x
reveal_type(x) # N: Revealed type is 'builtins.int'
[file xx/foo/bar/baz/boo.py]
x = ''
[file xx/foo/bar/baz/__init__.py]
[file yy/foo/bar/baz/boo.py]
x = 0
[file yy/foo/bar/__init__.py]
[file mypy.ini]
\[mypy]
mypy_path = TmP/xX, TmP/yY