Debian Codegraph @

test-data/unit/errorstream.test

raw
1 -- Test cases for incremental error streaming.
2 -- Each time errors are reported, '==== Errors flushed ====' is printed.
3
4 [case testErrorStream]
5 import b
6 [file a.py]
7 1 + ''
8 [file b.py]
9 import a
10 '' / 2
11 [out]
12 ==== Errors flushed ====
13 a.py:1: error: Unsupported operand types for + ("int" and "str")
14 ==== Errors flushed ====
15 b.py:2: error: Unsupported operand types for / ("str" and "int")
16
17 [case testBlockers]
18 import b
19 [file a.py]
20 1 + ''
21 [file b.py]
22 import a
23 break
24 1 / '' # won't get reported, after a blocker
25 [out]
26 ==== Errors flushed ====
27 a.py:1: error: Unsupported operand types for + ("int" and "str")
28 ==== Errors flushed ====
29 b.py:2: error: "break" outside loop
30
31 [case testCycles]
32 import a
33 [file a.py]
34 import b
35 1 + ''
36 def f() -> int:
37 reveal_type(b.x)
38 return b.x
39 y = 0 + int()
40 [file b.py]
41 import a
42 def g() -> int:
43 reveal_type(a.y)
44 return a.y
45 1 / ''
46 x = 1 + int()
47
48 [out]
49 ==== Errors flushed ====
50 b.py:3: note: Revealed type is "int"
51 b.py:5: error: Unsupported operand types for / ("int" and "str")
52 ==== Errors flushed ====
53 a.py:2: error: Unsupported operand types for + ("int" and "str")
54 a.py:4: note: Revealed type is "int"