Skip to content

Commit 6438bf0

Browse files
committed
Begin revising tests
1 parent d245e75 commit 6438bf0

File tree

1 file changed

+92
-14
lines changed

1 file changed

+92
-14
lines changed

test-data/unit/check-incremental.test

Lines changed: 92 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Parent: pass
120120
class A(Parent): pass
121121

122122
[rechecked mod1, mod2]
123-
[stale mod1, mod2]
123+
[stale mod2]
124124
[out]
125125

126126

@@ -142,8 +142,8 @@ def func3() -> None: pass
142142
[file mod3.py.next]
143143
def func3() -> int: return 2
144144

145-
[rechecked mod1, mod2, mod3]
146-
[stale mod1, mod2, mod3]
145+
[rechecked mod2, mod3]
146+
[stale mod3]
147147
[out]
148148

149149
[case testIncrementalInternalFunctionDefinitionChange]
@@ -221,7 +221,7 @@ class Foo:
221221
return "a"
222222

223223
[rechecked mod1, mod2]
224-
[stale mod1, mod2]
224+
[stale mod2]
225225
[out]
226226

227227
[case testIncrementalBaseClassChange]
@@ -244,7 +244,7 @@ class Bad: pass
244244
class Child(Bad): pass
245245

246246
[rechecked mod1, mod2]
247-
[stale mod1, mod2]
247+
[stale mod2]
248248
[out]
249249
main:1: note: In module imported here:
250250
tmp/mod1.py:2: error: "Child" has no attribute "good_method"
@@ -272,7 +272,7 @@ C = 3
272272
C = "A"
273273

274274
[rechecked mod1, mod2, mod3, mod4]
275-
[stale mod1, mod2, mod3, mod4]
275+
[stale mod2, mod3, mod4]
276276
[out]
277277
main:1: note: In module imported here:
278278
tmp/mod1.py:3: error: Argument 1 to "accepts_int" has incompatible type "str"; expected "int"
@@ -347,12 +347,67 @@ def func2() -> str:
347347
return "foo"
348348

349349
[rechecked mod1, mod2]
350-
[stale mod1, mod2]
350+
[stale mod2]
351351
[out]
352352
main:1: note: In module imported here:
353353
tmp/mod1.py: note: In function "func1":
354354
tmp/mod1.py:4: error: Incompatible return value type (got "str", expected "int")
355355

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+
356411
[case testIncrementalWithComplexDictExpression]
357412
import mod1
358413

@@ -372,7 +427,7 @@ my_dict = {
372427
}
373428

374429
[rechecked mod1, mod1_private]
375-
[stale mod1, mod1_private]
430+
[stale mod1_private]
376431
[builtins fixtures/dict.pyi]
377432
[out]
378433

@@ -433,7 +488,7 @@ def some_func(a: int) -> str:
433488
return "a"
434489

435490
[rechecked mod1, mod1_private]
436-
[stale mod1, mod1_private]
491+
[stale mod1_private]
437492
[builtins fixtures/ops.pyi]
438493
[out]
439494
main:1: note: In module imported here:
@@ -471,7 +526,7 @@ def stringify(f: Callable[[int], int]) -> Callable[[int], str]:
471526
def some_func(a: int) -> int:
472527
return a + 2
473528
[rechecked mod1, mod1_private]
474-
[stale mod1, mod1_private]
529+
[stale mod1_private]
475530
[builtins fixtures/ops.pyi]
476531
[out]
477532
main:1: note: In module imported here:
@@ -493,7 +548,7 @@ class Foo:
493548
A = "hello"
494549

495550
[rechecked mod1, mod2]
496-
[stale mod1, mod2]
551+
[stale mod2]
497552
[out]
498553

499554
[case testIncrementalChangingFields]
@@ -504,6 +559,28 @@ import mod2
504559
f = mod2.Foo()
505560
f.A
506561

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+
507584
[file mod2.py]
508585
class Foo:
509586
def __init__(self) -> None:
@@ -538,7 +615,7 @@ class Foo:
538615
self.A = "hello"
539616

540617
[rechecked mod1, mod2]
541-
[stale mod1, mod2]
618+
[stale mod2]
542619
[out]
543620
main:1: note: In module imported here:
544621
tmp/mod1.py:4: error: Argument 1 to "accept_int" has incompatible type "str"; expected "int"
@@ -562,7 +639,7 @@ class Foo:
562639
attr = "foo"
563640

564641
[rechecked mod1, mod2]
565-
[stale mod1, mod2]
642+
[stale mod2]
566643
[out]
567644

568645
[case testIncrementalSimpleBranchingModules]
@@ -793,14 +870,15 @@ class Class: pass
793870

794871
[builtins fixtures/args.pyi]
795872
[rechecked collections, main, package.subpackage.mod1]
796-
[stale collections, main, package.subpackage.mod1]
873+
[stale collections, package.subpackage.mod1]
797874
[out]
798875
tmp/main.py: note: In function "handle":
799876
tmp/main.py:4: error: "Class" has no attribute "some_attribute"
800877

801878
[case testIncrementalWithIgnores]
802879
import foo # type: ignore
803880

881+
[builtins fixtures/args.pyi]
804882
[stale]
805883
[out]
806884

0 commit comments

Comments
 (0)