File: errorstream.test

package info (click to toggle)
mypy 1.19.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,412 kB
  • sloc: python: 114,754; ansic: 13,343; cpp: 11,380; makefile: 257; sh: 28
file content (54 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (3)
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
-- Test cases for incremental error streaming.
-- Each time errors are reported, '==== Errors flushed ====' is printed.

[case testErrorStream]
import b
[file a.py]
1 + ''
[file b.py]
import a
'' / 2
[out]
==== Errors flushed ====
a.py:1: error: Unsupported operand types for + ("int" and "str")
==== Errors flushed ====
b.py:2: error: Unsupported operand types for / ("str" and "int")

[case testBlockers]
import b
[file a.py]
1 + ''
[file b.py]
import a
break
1 / ''  # won't get reported, after a blocker
[out]
==== Errors flushed ====
a.py:1: error: Unsupported operand types for + ("int" and "str")
==== Errors flushed ====
b.py:2: error: "break" outside loop

[case testCycles]
import a
[file a.py]
import b
1 + ''
def f() -> int:
    reveal_type(b.x)
    return b.x
y = 0 + int()
[file b.py]
import a
def g() -> int:
    reveal_type(a.y)
    return a.y
1 / ''
x = 1 + int()

[out]
==== Errors flushed ====
b.py:3: note: Revealed type is "builtins.int"
b.py:5: error: Unsupported operand types for / ("int" and "str")
==== Errors flushed ====
a.py:2: error: Unsupported operand types for + ("int" and "str")
a.py:4: note: Revealed type is "builtins.int"