@@ -120,7 +120,7 @@ class Parent: pass
120
120
class A(Parent): pass
121
121
122
122
[rechecked mod1, mod2]
123
- [stale mod1, mod2]
123
+ [stale mod2]
124
124
[out]
125
125
126
126
@@ -142,8 +142,8 @@ def func3() -> None: pass
142
142
[file mod3.py.next]
143
143
def func3() -> int: return 2
144
144
145
- [rechecked mod1, mod2, mod3]
146
- [stale mod1, mod2, mod3]
145
+ [rechecked mod2, mod3]
146
+ [stale mod3]
147
147
[out]
148
148
149
149
[case testIncrementalInternalFunctionDefinitionChange]
@@ -221,7 +221,7 @@ class Foo:
221
221
return "a"
222
222
223
223
[rechecked mod1, mod2]
224
- [stale mod1, mod2]
224
+ [stale mod2]
225
225
[out]
226
226
227
227
[case testIncrementalBaseClassChange]
@@ -244,7 +244,7 @@ class Bad: pass
244
244
class Child(Bad): pass
245
245
246
246
[rechecked mod1, mod2]
247
- [stale mod1, mod2]
247
+ [stale mod2]
248
248
[out]
249
249
main:1: note: In module imported here:
250
250
tmp/mod1.py:2: error: "Child" has no attribute "good_method"
@@ -272,7 +272,7 @@ C = 3
272
272
C = "A"
273
273
274
274
[rechecked mod1, mod2, mod3, mod4]
275
- [stale mod1, mod2, mod3, mod4]
275
+ [stale mod2, mod3, mod4]
276
276
[out]
277
277
main:1: note: In module imported here:
278
278
tmp/mod1.py:3: error: Argument 1 to "accepts_int" has incompatible type "str"; expected "int"
@@ -347,12 +347,67 @@ def func2() -> str:
347
347
return "foo"
348
348
349
349
[rechecked mod1, mod2]
350
- [stale mod1, mod2]
350
+ [stale mod2]
351
351
[out]
352
352
main:1: note: In module imported here:
353
353
tmp/mod1.py: note: In function "func1":
354
354
tmp/mod1.py:4: error: Incompatible return value type (got "str", expected "int")
355
355
356
+ [case testIncrementalBadChangeWithSave]
357
+ import mod0
358
+
359
+ [file mod0.py]
360
+ import mod1
361
+ A = mod1.func2()
362
+
363
+ [file mod1.py]
364
+ from mod2 import func2
365
+
366
+ def func1() -> int:
367
+ return func2()
368
+
369
+ [file mod2.py]
370
+ def func2() -> int:
371
+ return 1
372
+
373
+ [file mod2.py.next]
374
+ def func2() -> str:
375
+ return "foo"
376
+
377
+ [rechecked mod0, mod1, mod2]
378
+ [stale mod0, mod2]
379
+ [out]
380
+ tmp/mod0.py:1: note: In module imported here,
381
+ main:1: note: ... from here:
382
+ tmp/mod1.py: note: In function "func1":
383
+ tmp/mod1.py:4: error: Incompatible return value type (got "str", expected "int")
384
+
385
+ [case testIncrementalOkChangeWithSave]
386
+ import mod0
387
+
388
+ [file mod0.py]
389
+ import mod1
390
+ A = mod1.func2()
391
+
392
+ [file mod1.py]
393
+ from mod2 import func2
394
+
395
+ def func1() -> int:
396
+ func2()
397
+ return 1
398
+
399
+ [file mod2.py]
400
+ def func2() -> int:
401
+ return 1
402
+
403
+ [file mod2.py.next]
404
+ def func2() -> str:
405
+ return "foo"
406
+
407
+ [rechecked mod0, mod1, mod2]
408
+ [stale mod0, mod2]
409
+ [out]
410
+
356
411
[case testIncrementalWithComplexDictExpression]
357
412
import mod1
358
413
@@ -372,7 +427,7 @@ my_dict = {
372
427
}
373
428
374
429
[rechecked mod1, mod1_private]
375
- [stale mod1, mod1_private]
430
+ [stale mod1_private]
376
431
[builtins fixtures/dict.pyi]
377
432
[out]
378
433
@@ -433,7 +488,7 @@ def some_func(a: int) -> str:
433
488
return "a"
434
489
435
490
[rechecked mod1, mod1_private]
436
- [stale mod1, mod1_private]
491
+ [stale mod1_private]
437
492
[builtins fixtures/ops.pyi]
438
493
[out]
439
494
main:1: note: In module imported here:
@@ -471,7 +526,7 @@ def stringify(f: Callable[[int], int]) -> Callable[[int], str]:
471
526
def some_func(a: int) -> int:
472
527
return a + 2
473
528
[rechecked mod1, mod1_private]
474
- [stale mod1, mod1_private]
529
+ [stale mod1_private]
475
530
[builtins fixtures/ops.pyi]
476
531
[out]
477
532
main:1: note: In module imported here:
@@ -493,7 +548,7 @@ class Foo:
493
548
A = "hello"
494
549
495
550
[rechecked mod1, mod2]
496
- [stale mod1, mod2]
551
+ [stale mod2]
497
552
[out]
498
553
499
554
[case testIncrementalChangingFields]
@@ -504,6 +559,28 @@ import mod2
504
559
f = mod2.Foo()
505
560
f.A
506
561
562
+ [file mod2.py]
563
+ class Foo:
564
+ def __init__(self) -> None:
565
+ self.A = 3
566
+
567
+ [file mod2.py.next]
568
+ class Foo:
569
+ def __init__(self) -> None:
570
+ self.A = "hello"
571
+
572
+ [rechecked mod1, mod2]
573
+ [stale mod2]
574
+ [out]
575
+
576
+ [case testIncrementalChangingFieldsWithAssignment]
577
+ import mod1
578
+
579
+ [file mod1.py]
580
+ import mod2
581
+ f = mod2.Foo()
582
+ B = f.A
583
+
507
584
[file mod2.py]
508
585
class Foo:
509
586
def __init__(self) -> None:
@@ -538,7 +615,7 @@ class Foo:
538
615
self.A = "hello"
539
616
540
617
[rechecked mod1, mod2]
541
- [stale mod1, mod2]
618
+ [stale mod2]
542
619
[out]
543
620
main:1: note: In module imported here:
544
621
tmp/mod1.py:4: error: Argument 1 to "accept_int" has incompatible type "str"; expected "int"
@@ -562,7 +639,7 @@ class Foo:
562
639
attr = "foo"
563
640
564
641
[rechecked mod1, mod2]
565
- [stale mod1, mod2]
642
+ [stale mod2]
566
643
[out]
567
644
568
645
[case testIncrementalSimpleBranchingModules]
@@ -793,14 +870,15 @@ class Class: pass
793
870
794
871
[builtins fixtures/args.pyi]
795
872
[rechecked collections, main, package.subpackage.mod1]
796
- [stale collections, main, package.subpackage.mod1]
873
+ [stale collections, package.subpackage.mod1]
797
874
[out]
798
875
tmp/main.py: note: In function "handle":
799
876
tmp/main.py:4: error: "Class" has no attribute "some_attribute"
800
877
801
878
[case testIncrementalWithIgnores]
802
879
import foo # type: ignore
803
880
881
+ [builtins fixtures/args.pyi]
804
882
[stale]
805
883
[out]
806
884
0 commit comments