forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-modules-case.test
More file actions
69 lines (57 loc) · 1.6 KB
/
check-modules-case.test
File metadata and controls
69 lines (57 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- 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) # E: 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) # E: 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) # E: 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