Commit 62d8709
authored
[mypyc] Display IR on annotate test failure (#18835)
This makes it easier to figure out why a test is failing.
Example output on failure:
```
=================================== FAILURES ====================================
________________________ testAnnotateTwoOperationsOnLine ________________________
data: /Users/jukka/src/mypy/mypyc/test-data/annotate-basic.test:18:
Failed: Invalid source code output (/Users/jukka/src/mypy/mypyc/test-data/annotate-basic.test, line 18)
----------------------------- Captured stdout call ------------------------------
Generated IR:
def f(x):
x :: object
r0 :: str
r1, r2, r3 :: object
L0:
r0 = 'foo'
r1 = CPyObject_GetAttr(x, r0)
r2 = object 1
r3 = PyNumber_Add(r1, r2)
return r3
----------------------------- Captured stderr call ------------------------------
Expected:
main:2: Get non-native attribute "foo". Generic "+" operation.x (diff)
Actual:
main:2: Get non-native attribute "foo". Generic "+" operation. (diff)
Alignment of first line difference:
E: ...Generic "+" operation.x
A: ...Generic "+" operation.
^
Update the test output using --update-data (implies -n0; you can additionally use the -k selector to update only specific tests)
```1 parent af96893 commit 62d8709
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
0 commit comments