@@ -119,10 +119,10 @@ reveal_type(a)
119
119
testTypedPkgSimpleEditableEgg.py:5: note: Revealed type is "builtins.tuple[builtins.str]"
120
120
121
121
[case testTypedPkgNamespaceImportFrom]
122
- # pkgs: typedpkg, typedpkg_ns
122
+ # pkgs: typedpkg, typedpkg_ns_a
123
123
from typedpkg.pkg.aaa import af
124
- from typedpkg_ns.ns .bbb import bf
125
- from typedpkg_ns.ns .dne import dne
124
+ from typedpkg_ns.a .bbb import bf
125
+ from typedpkg_ns.a .dne import dne
126
126
127
127
af("abc")
128
128
bf(False)
@@ -132,16 +132,16 @@ af(False)
132
132
bf(2)
133
133
dne("abc")
134
134
[out]
135
- testTypedPkgNamespaceImportFrom.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.ns .dne"
135
+ testTypedPkgNamespaceImportFrom.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a .dne"
136
136
testTypedPkgNamespaceImportFrom.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
137
137
testTypedPkgNamespaceImportFrom.py:10: error: Argument 1 to "af" has incompatible type "bool"; expected "str"
138
138
testTypedPkgNamespaceImportFrom.py:11: error: Argument 1 to "bf" has incompatible type "int"; expected "bool"
139
139
140
140
[case testTypedPkgNamespaceImportAs]
141
- # pkgs: typedpkg, typedpkg_ns
141
+ # pkgs: typedpkg, typedpkg_ns_a
142
142
import typedpkg.pkg.aaa as nm; af = nm.af
143
- import typedpkg_ns.ns .bbb as am; bf = am.bf
144
- from typedpkg_ns.ns .dne import dne
143
+ import typedpkg_ns.a .bbb as am; bf = am.bf
144
+ from typedpkg_ns.a .dne import dne
145
145
146
146
af("abc")
147
147
bf(False)
@@ -151,16 +151,16 @@ af(False)
151
151
bf(2)
152
152
dne("abc")
153
153
[out]
154
- testTypedPkgNamespaceImportAs.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.ns .dne"
154
+ testTypedPkgNamespaceImportAs.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a .dne"
155
155
testTypedPkgNamespaceImportAs.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
156
156
testTypedPkgNamespaceImportAs.py:10: error: Argument 1 has incompatible type "bool"; expected "str"
157
157
testTypedPkgNamespaceImportAs.py:11: error: Argument 1 has incompatible type "int"; expected "bool"
158
158
159
159
[case testTypedPkgNamespaceRegImport]
160
- # pkgs: typedpkg, typedpkg_ns
160
+ # pkgs: typedpkg, typedpkg_ns_a
161
161
import typedpkg.pkg.aaa; af = typedpkg.pkg.aaa.af
162
- import typedpkg_ns.ns .bbb; bf = typedpkg_ns.ns .bbb.bf
163
- from typedpkg_ns.ns .dne import dne
162
+ import typedpkg_ns.a .bbb; bf = typedpkg_ns.a .bbb.bf
163
+ from typedpkg_ns.a .dne import dne
164
164
165
165
af("abc")
166
166
bf(False)
@@ -171,7 +171,7 @@ bf(2)
171
171
dne("abc")
172
172
173
173
[out]
174
- testTypedPkgNamespaceRegImport.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.ns .dne"
174
+ testTypedPkgNamespaceRegImport.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a .dne"
175
175
testTypedPkgNamespaceRegImport.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
176
176
testTypedPkgNamespaceRegImport.py:10: error: Argument 1 has incompatible type "bool"; expected "str"
177
177
testTypedPkgNamespaceRegImport.py:11: error: Argument 1 has incompatible type "int"; expected "bool"
@@ -188,9 +188,37 @@ import a
188
188
a.py:1: error: Unsupported operand types for + ("int" and "str")
189
189
190
190
[case testTypedPkgNamespaceRegFromImportTwice]
191
- # pkgs: typedpkg_ns
192
- from typedpkg_ns import ns
191
+ # pkgs: typedpkg_ns_a
192
+ from typedpkg_ns import a
193
193
-- dummy should trigger a second iteration
194
194
[file dummy.py.2]
195
195
[out]
196
196
[out2]
197
+
198
+ [case testNamespacePkgWStubs]
199
+ # pkgs: typedpkg_ns_a, typedpkg_ns_b, typedpkg_ns_b-stubs
200
+ # flags: --no-namespace-packages
201
+ import typedpkg_ns.a.bbb as a
202
+ import typedpkg_ns.b.bbb as b
203
+ a.bf(False)
204
+ b.bf(False)
205
+ a.bf(1)
206
+ b.bf(1)
207
+ [out]
208
+ testNamespacePkgWStubs.py:4: error: Skipping analyzing "typedpkg_ns.b.bbb": found module but no type hints or library stubs
209
+ testNamespacePkgWStubs.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
210
+ testNamespacePkgWStubs.py:4: error: Skipping analyzing "typedpkg_ns.b": found module but no type hints or library stubs
211
+ testNamespacePkgWStubs.py:7: error: Argument 1 to "bf" has incompatible type "int"; expected "bool"
212
+
213
+ [case testNamespacePkgWStubsWithNamespacePackagesFlag]
214
+ # pkgs: typedpkg_ns_a, typedpkg_ns_b, typedpkg_ns_b-stubs
215
+ # flags: --namespace-packages
216
+ import typedpkg_ns.a.bbb as a
217
+ import typedpkg_ns.b.bbb as b
218
+ a.bf(False)
219
+ b.bf(False)
220
+ a.bf(1)
221
+ b.bf(1)
222
+ [out]
223
+ testNamespacePkgWStubsWithNamespacePackagesFlag.py:7: error: Argument 1 to "bf" has incompatible type "int"; expected "bool"
224
+ testNamespacePkgWStubsWithNamespacePackagesFlag.py:8: error: Argument 1 to "bf" has incompatible type "int"; expected "bool"
0 commit comments