-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
cmdline.pyproject.test
135 lines (126 loc) · 3.28 KB
/
cmdline.pyproject.test
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
-- Tests for command line parsing
-- ------------------------------
--
-- The initial line specifies the command line, in the format
--
-- # cmd: mypy <options>
--
-- Note that # flags: --some-flag IS NOT SUPPORTED.
-- Use # cmd: mypy --some-flag ...
--
-- '== Return code: <value>' is added to the output when the process return code
-- is "nonobvious" -- that is, when it is something other than 0 if there are no
-- messages and 1 if there are.
-- Directories/packages on the command line
-- ----------------------------------------
[case testNonArrayOverridesPyprojectTOML]
# cmd: mypy x.py
[file pyproject.toml]
\[tool.mypy]
\[tool.mypy.overrides]
module = "x"
disallow_untyped_defs = false
[file x.py]
def f(a):
pass
def g(a: int) -> int:
return f(a)
[out]
./pyproject.toml: tool.mypy.overrides sections must be an array. Please make sure you are using double brackets like so: [[tool.mypy.overrides]]
== Return code: 0
[case testNoModuleInOverridePyprojectTOML]
# cmd: mypy x.py
[file pyproject.toml]
\[tool.mypy]
\[[tool.mypy.overrides]]
disallow_untyped_defs = false
[file x.py]
def f(a):
pass
def g(a: int) -> int:
return f(a)
[out]
./pyproject.toml: toml config file contains a [[tool.mypy.overrides]] section, but no module to override was specified.
== Return code: 0
[case testInvalidModuleInOverridePyprojectTOML]
# cmd: mypy x.py
[file pyproject.toml]
\[tool.mypy]
\[[tool.mypy.overrides]]
module = 0
disallow_untyped_defs = false
[file x.py]
def f(a):
pass
def g(a: int) -> int:
return f(a)
[out]
./pyproject.toml: toml config file contains a [[tool.mypy.overrides]] section with a module value that is not a string or a list of strings
== Return code: 0
[case testConflictingModuleInOverridesPyprojectTOML]
# cmd: mypy x.py
[file pyproject.toml]
\[tool.mypy]
\[[tool.mypy.overrides]]
module = 'x'
disallow_untyped_defs = false
\[[tool.mypy.overrides]]
module = ['x']
disallow_untyped_defs = true
[file x.py]
def f(a):
pass
def g(a: int) -> int:
return f(a)
[out]
./pyproject.toml: toml config file contains [[tool.mypy.overrides]] sections with conflicting values. Module 'x' has two different values for 'disallow_untyped_defs'
== Return code: 0
[case testMultilineLiteralExcludePyprojectTOML]
# cmd: mypy x
[file pyproject.toml]
\[tool.mypy]
exclude = '''(?x)(
(^|/)[^/]*skipme_\.py$
|(^|/)_skipme[^/]*\.py$
)'''
[file x/__init__.py]
i: int = 0
[file x/_skipme_please.py]
This isn't even syntatically valid!
[file x/please_skipme_.py]
Neither is this!
[case testMultilineBasicExcludePyprojectTOML]
# cmd: mypy x
[file pyproject.toml]
\[tool.mypy]
exclude = """(?x)(
(^|/)[^/]*skipme_\\.py$
|(^|/)_skipme[^/]*\\.py$
)"""
[file x/__init__.py]
i: int = 0
[file x/_skipme_please.py]
This isn't even syntatically valid!
[file x/please_skipme_.py]
Neither is this!
[case testSequenceExcludePyprojectTOML]
# cmd: mypy x
[file pyproject.toml]
\[tool.mypy]
exclude = [
'(^|/)[^/]*skipme_\.py$', # literal (no escaping)
"(^|/)_skipme[^/]*\\.py$", # basic (backslash needs escaping)
]
[file x/__init__.py]
i: int = 0
[file x/_skipme_please.py]
This isn't even syntatically valid!
[file x/please_skipme_.py]
Neither is this!
[case testPyprojectTOMLUnicode]
# cmd: mypy x.py
[file pyproject.toml]
\[project]
description = "Factory ⸻ A code generator 🏭"
\[tool.mypy]
[file x.py]