/
check-custom-plugin.test
599 lines (506 loc) · 18.6 KB
/
check-custom-plugin.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
-- Test cases for user-defined plugins
--
-- Note: Plugins used by tests live under test-data/unit/plugins. Defining
-- plugin files in test cases does not work reliably.
[case testFunctionPluginFile]
# flags: --config-file tmp/mypy.ini
def f() -> str: ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/fnplugin.py
[case testFunctionPlugin]
# flags: --config-file tmp/mypy.ini
def f() -> str: ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
[file mypy.ini]
[[mypy]
plugins=fnplugin
[case testFunctionPluginFullnameIsNotNone]
# flags: --config-file tmp/mypy.ini
from typing import Callable, TypeVar
f: Callable[[], None]
T = TypeVar('T')
def g(x: T) -> T: return x # This strips out the name of a callable
g(f)()
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/fnplugin.py
[case testTwoPlugins]
# flags: --config-file tmp/mypy.ini
def f(): ...
def g(): ...
def h(): ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
reveal_type(g()) # E: Revealed type is 'builtins.str'
reveal_type(h()) # E: Revealed type is 'Any'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/fnplugin.py,
<ROOT>/test-data/unit/plugins/plugin2.py
[case testTwoPluginsMixedType]
# flags: --config-file tmp/mypy.ini
def f(): ...
def g(): ...
def h(): ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
reveal_type(g()) # E: Revealed type is 'builtins.str'
reveal_type(h()) # E: Revealed type is 'Any'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/fnplugin.py, plugin2
[case testMissingPluginFile]
# flags: --config-file tmp/mypy.ini
[file mypy.ini]
[[mypy]
plugins=missing.py
[out]
tmp/mypy.ini:2: error: Can't find plugin 'tmp/missing.py'
--' (work around syntax highlighting)
[case testMissingPlugin]
# flags: --config-file tmp/mypy.ini
[file mypy.ini]
[[mypy]
plugins=missing
[out]
tmp/mypy.ini:2: error: Error importing plugin 'missing'
[case testMultipleSectionsDefinePlugin]
# flags: --config-file tmp/mypy.ini
[file mypy.ini]
[[acme]
plugins=acmeplugin
[[mypy]
plugins=missing.py
[[another]
plugins=another_plugin
[out]
tmp/mypy.ini:4: error: Can't find plugin 'tmp/missing.py'
--' (work around syntax highlighting)
[case testInvalidPluginExtension]
# flags: --config-file tmp/mypy.ini
[file mypy.ini]
[[mypy]
plugins=dir/badext.pyi
[file dir/badext.pyi]
[out]
tmp/mypy.ini:2: error: Plugin 'badext.pyi' does not have a .py extension
[case testMissingPluginEntryPoint]
# flags: --config-file tmp/mypy.ini
[file mypy.ini]
[[mypy]
plugins = <ROOT>/test-data/unit/plugins/noentry.py
[out]
tmp/mypy.ini:2: error: Plugin '<ROOT>/test-data/unit/plugins/noentry.py' does not define entry point function "plugin"
[case testCustomPluginEntryPointFile]
# flags: --config-file tmp/mypy.ini
def f() -> str: ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/customentry.py:register
[case testCustomPluginEntryPoint]
# flags: --config-file tmp/mypy.ini
def f() -> str: ...
reveal_type(f()) # E: Revealed type is 'builtins.int'
[file mypy.ini]
[[mypy]
plugins=customentry:register
[case testInvalidPluginEntryPointReturnValue]
# flags: --config-file tmp/mypy.ini
def f(): pass
f()
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/badreturn.py
[out]
tmp/mypy.ini:3: error: Type object expected as the return value of "plugin"; got None (in <ROOT>/test-data/unit/plugins/badreturn.py)
[case testInvalidPluginEntryPointReturnValue2]
# flags: --config-file tmp/mypy.ini
def f(): pass
f()
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/badreturn2.py
[out]
tmp/mypy.ini:2: error: Return value of "plugin" must be a subclass of "mypy.plugin.Plugin" (in <ROOT>/test-data/unit/plugins/badreturn2.py)
[case testAttributeTypeHookPlugin]
# flags: --config-file tmp/mypy.ini
from typing import Callable
from m import Signal, DerivedSignal
s: Signal[Callable[[int], None]] = Signal()
s(1)
s('') # E: Argument 1 has incompatible type "str"; expected "int"
ds: DerivedSignal[Callable[[int], None]] = DerivedSignal()
ds('') # E: Argument 1 has incompatible type "str"; expected "int"
[file m.py]
from typing import TypeVar, Generic, Callable
T = TypeVar('T', bound=Callable[..., None])
class Signal(Generic[T]):
__call__: Callable[..., None] # This type is replaced by the plugin
class DerivedSignal(Signal[T]): ...
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/attrhook.py
[case testAttributeHookPluginForDynamicClass]
# flags: --config-file tmp/mypy.ini
from m import Magic, DerivedMagic
magic = Magic()
reveal_type(magic.magic_field) # E: Revealed type is 'builtins.str'
reveal_type(magic.non_magic_method()) # E: Revealed type is 'builtins.int'
reveal_type(magic.non_magic_field) # E: Revealed type is 'builtins.int'
magic.nonexistent_field # E: Field does not exist
reveal_type(magic.fallback_example) # E: Revealed type is 'Any'
reveal_type(DerivedMagic().magic_field) # E: Revealed type is 'builtins.str'
[file m.py]
from typing import Any
class Magic:
# Triggers plugin infrastructure:
def __getattr__(self, x: Any) -> Any: ...
def non_magic_method(self) -> int: ...
non_magic_field: int
class DerivedMagic(Magic): ...
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/attrhook2.py
[case testTypeAnalyzeHookPlugin]
# flags: --config-file tmp/mypy.ini
from typing import Callable
from mypy_extensions import DefaultArg
from m import Signal
s: Signal[[int, DefaultArg(str, 'x')]] = Signal()
reveal_type(s) # E: Revealed type is 'm.Signal[def (builtins.int, x: builtins.str =)]'
s.x # E: "Signal[Callable[[int, str], None]]" has no attribute "x"
ss: Signal[int, str] # E: Invalid "Signal" type (expected "Signal[[t, ...]]")
[file m.py]
from typing import TypeVar, Generic, Callable
T = TypeVar('T', bound=Callable[..., None])
class Signal(Generic[T]):
__call__: Callable[..., None]
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/type_anal_hook.py
[builtins fixtures/dict.pyi]
[case testFunctionPluginHookForClass]
# flags: --config-file tmp/mypy.ini
import mod
from mod import AttrInt
Alias = AttrInt
AnotherAlias = mod.Attr
class C:
x = Alias()
y = mod.AttrInt(required=True)
z = AnotherAlias(int, required=False)
c = C()
reveal_type(c.x) # E: Revealed type is 'Union[builtins.int, None]'
reveal_type(c.y) # E: Revealed type is 'builtins.int*'
reveal_type(c.z) # E: Revealed type is 'Union[builtins.int*, None]'
[file mod.py]
from typing import Generic, TypeVar, Type
T = TypeVar('T')
class Attr(Generic[T]):
def __init__(self, tp: Type[T], required: bool = False) -> None:
pass
def __get__(self, instance: object, owner: type) -> T:
pass
class AttrInt(Attr[int]):
def __init__(self, required: bool = False) -> None:
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/class_callable.py
[builtins fixtures/bool.pyi]
[out]
[case testFunctionPluginHookForReturnedCallable]
# flags: --config-file tmp/mypy.ini
from m import decorator1, decorator2
@decorator1()
def f() -> None: pass
@decorator2()
def g() -> None: pass
reveal_type(f) # E: Revealed type is 'def (*Any, **Any) -> builtins.str'
reveal_type(g) # E: Revealed type is 'def (*Any, **Any) -> builtins.int'
[file m.py]
from typing import Callable
def decorator1() -> Callable[..., Callable[..., int]]: pass
def decorator2() -> Callable[..., Callable[..., int]]: pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/named_callable.py
[case testFunctionMethodContextsHasArgNames]
# flags: --config-file tmp/mypy.ini
from mod import Class, func
reveal_type(Class().method(arg1=1, arg2=2, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(Class.myclassmethod(arg1=1, arg2=2, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(Class.mystaticmethod(arg1=1, arg2=2, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(Class.method(self=Class(), arg1=1, arg2=2, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(func(arg1=1, arg2=2, classname='builtins.str')) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class Class:
def method(self, classname: str, arg1: Any, arg2: Any) -> Any:
pass
@classmethod
def myclassmethod(cls, classname: str, arg1: Any, arg2: Any):
pass
@staticmethod
def mystaticmethod(classname: str, arg1: Any, arg2: Any):
pass
def func(classname: str, arg1: Any, arg2: Any) -> Any:
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[builtins fixtures/classmethod.pyi]
[case testFunctionMethodContextsHasArgNamesPositionals]
# flags: --config-file tmp/mypy.ini
from mod import Class, func
reveal_type(Class().method('builtins.str', arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
reveal_type(Class.myclassmethod('builtins.str', arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
reveal_type(Class.mystaticmethod('builtins.str', arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
reveal_type(Class.method(Class(), 'builtins.str', arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
reveal_type(func('builtins.str', arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class Class:
def method(self, classname: str, arg1: Any, arg2: Any) -> Any:
pass
@classmethod
def myclassmethod(cls, classname: str, arg1: Any, arg2: Any):
pass
@staticmethod
def mystaticmethod(classname: str, arg1: Any, arg2: Any):
pass
def func(classname: str, arg1: Any, arg2: Any) -> Any:
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[builtins fixtures/classmethod.pyi]
[case testFunctionMethodContextsHasArgNamesInitMethod]
# flags: --config-file tmp/mypy.ini
from mod import ClassInit, Outer
reveal_type(ClassInit('builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(ClassInit(classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(Outer.NestedClassInit(classname='builtins.str')) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class ClassInit:
def __init__(self, classname: str):
pass
class Outer:
class NestedClassInit:
def __init__(self, classname: str):
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[case testFunctionMethodContextsHasArgNamesUnfilledArguments]
# flags: --config-file tmp/mypy.ini
from mod import ClassUnfilled, func_unfilled
reveal_type(ClassUnfilled().method(classname='builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassUnfilled().method(arg2=1, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(ClassUnfilled().method('builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(func_unfilled(classname='builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(func_unfilled(arg2=1, classname='builtins.str')) # E: Revealed type is 'builtins.str'
reveal_type(func_unfilled('builtins.str')) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class ClassUnfilled:
def method(self, classname: str, arg1: Any = None, arg2: Any = None) -> Any:
pass
def func_unfilled(classname: str, arg1: Any = None, arg2: Any = None) -> Any:
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[case testFunctionMethodContextsHasArgNamesStarExpressions]
# flags: --config-file tmp/mypy.ini
from mod import ClassStarExpr, func_star_expr
reveal_type(ClassStarExpr().method(classname='builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassStarExpr().method('builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassStarExpr().method('builtins.str', arg1=1, arg2=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassStarExpr().method('builtins.str', 2, 3, 4, arg1=1, arg2=1)) # E: Revealed type is 'builtins.str'
reveal_type(func_star_expr(classname='builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(func_star_expr('builtins.str', arg1=1)) # E: Revealed type is 'builtins.str'
reveal_type(func_star_expr('builtins.str', 2, 3, 4, arg1=1, arg2=2)) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class ClassStarExpr:
def method(self, classname: str, *args, **kwargs) -> Any:
pass
def func_star_expr(classname: str, *args, **kwargs) -> Any:
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[builtins fixtures/dict.pyi]
[case testFunctionMethodContextArgNamesForInheritedMethods]
# flags: --config-file tmp/mypy.ini
from mod import ClassChild
reveal_type(ClassChild().method(classname='builtins.str', arg1=1, arg2=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassChild().method(arg1=1, classname='builtins.str', arg2=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassChild().method('builtins.str', arg1=1, arg2=1)) # E: Revealed type is 'builtins.str'
reveal_type(ClassChild.myclassmethod('builtins.str')) # E: Revealed type is 'builtins.str'
[file mod.py]
from typing import Any
class Base:
def method(self, classname: str, arg1: Any, arg2: Any) -> Any:
pass
@classmethod
def myclassmethod(cls, classname: str) -> Any:
pass
class ClassChild(Base):
pass
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_names.py
[builtins fixtures/classmethod.pyi]
[case testMethodSignatureHook]
# flags: --config-file tmp/mypy.ini
from typing import Iterator
class Foo:
# Test that method signature hooks are applied in various cases: explicit method calls, and
# implicit dunder method calls through language syntax.
# The plugin's method signature hook should turn all str occurrences into int.
def __init__(self) -> None: ...
def __getitem__(self, index: str) -> str: ...
def __setitem__(self, index: str, value: str) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __next__(self) -> str: ...
def __call__(self, *args: str) -> str: ...
def m(self, arg: str) -> str: ...
foo = Foo()
reveal_type(foo.m(2)) # E: Revealed type is 'builtins.int'
reveal_type(foo[3]) # E: Revealed type is 'builtins.int'
reveal_type(foo(4, 5, 6)) # E: Revealed type is 'builtins.int'
foo[4] = 5
for x in foo:
reveal_type(x) # E: Revealed type is 'builtins.int*'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/method_sig_hook.py
[case testMethodSignatureHookNamesFullyQualified]
# flags: --config-file tmp/mypy.ini
from mypy_extensions import TypedDict
from typing import NamedTuple
class FullyQualifiedTestClass:
@classmethod
def class_method(self) -> str: ...
def instance_method(self) -> str: ...
class FullyQualifiedTestTypedDict(TypedDict):
foo: str
FullyQualifiedTestNamedTuple = NamedTuple('FullyQualifiedTestNamedTuple', [('foo', str)])
# Check the return types to ensure that the method signature hook is called in each case
reveal_type(FullyQualifiedTestClass.class_method()) # E: Revealed type is 'builtins.int'
reveal_type(FullyQualifiedTestClass().instance_method()) # E: Revealed type is 'builtins.int'
reveal_type(FullyQualifiedTestNamedTuple('')._asdict()) # E: Revealed type is 'builtins.int'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/fully_qualified_test_hook.py
[builtins fixtures/classmethod.pyi]
[case testDynamicClassPlugin]
# flags: --config-file tmp/mypy.ini
from mod import declarative_base, Column, Instr
Base = declarative_base()
class Model(Base):
x: Column[int]
class Other:
x: Column[int]
reveal_type(Model().x) # E: Revealed type is 'mod.Instr[builtins.int]'
reveal_type(Other().x) # E: Revealed type is 'mod.Column[builtins.int]'
[file mod.py]
from typing import Generic, TypeVar
def declarative_base(): ...
T = TypeVar('T')
class Column(Generic[T]): ...
class Instr(Generic[T]): ...
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/dyn_class.py
[case testDynamicClassPluginNegatives]
# flags: --new-semantic-analyzer --config-file tmp/mypy.ini
from mod import declarative_base, Column, Instr, non_declarative_base
Bad1 = non_declarative_base()
Bad2 = Bad3 = declarative_base()
class C1(Bad1): ... # E: Invalid type "__main__.Bad1" \
# E: Invalid base class
class C2(Bad2): ... # E: Invalid type "__main__.Bad2" \
# E: Invalid base class
class C3(Bad3): ... # E: Invalid type "__main__.Bad3" \
# E: Invalid base class
[file mod.py]
from typing import Generic, TypeVar
def declarative_base(): ...
def non_declarative_base(): ...
T = TypeVar('T')
class Column(Generic[T]): ...
class Instr(Generic[T]): ...
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/dyn_class.py
[case testBaseClassPluginHookWorksIncremental]
# flags: --config-file tmp/mypy.ini
import a
[file a.py]
from base import Base
class C(Base): ...
[file a.py.2]
from base import Base
class C(Base): ...
reveal_type(C().__magic__)
Base.__magic__
[file base.py]
from lib import declarative_base
Base = declarative_base()
[file lib.py]
from typing import Any
def declarative_base() -> Any: ...
[file mypy.ini]
[[mypy]
python_version=3.6
plugins=<ROOT>/test-data/unit/plugins/common_api_incremental.py
[out]
[out2]
tmp/a.py:3: error: Revealed type is 'builtins.str'
tmp/a.py:4: error: "Type[Base]" has no attribute "__magic__"
[case testArgKindsMethod]
# flags: --config-file tmp/mypy.ini
class Class:
def method(self, *args, **kwargs):
pass
Class().method(1, *[2], **{'a': 1}) # E: [[0, 2], [4]]
[builtins fixtures/dict.pyi]
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_kinds.py
[case testArgKindsFunction]
# flags: --config-file tmp/mypy.ini
def func(*args, **kwargs):
pass
func(1, 2, [3, 4], *[5, 6, 7], **{'a': 1}) # E: [[0, 0, 0, 2], [4]]
[builtins fixtures/dict.pyi]
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/arg_kinds.py
[case testHookCallableInstance]
# flags: --config-file tmp/mypy.ini
from typing import Generic, TypeVar
T = TypeVar("T")
class Class(Generic[T]):
def __init__(self, one: T): ...
def __call__(self, two: T) -> int: ...
reveal_type(Class("hi")("there")) # E: Revealed type is 'builtins.str*'
instance = Class(3.14)
reveal_type(instance(2)) # E: Revealed type is 'builtins.float*'
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/callable_instance.py
[case testPluginDependencies]
# flags: --config-file tmp/mypy.ini
# The top level file here doesn't do anything, but the plugin should add
# a dependency on err that will cause err to be processed and an error reported.
[file err.py]
1 + 'lol' # E: Unsupported operand types for + ("int" and "str")
[file mypy.ini]
[[mypy]
plugins=<ROOT>/test-data/unit/plugins/depshook.py