Repository navigation
Commit ae65813
committed
feat(rewrite): introspect container[key] in failure messages
A subscript was opaque: the message showed the value it produced with no
indication of which container or key it came from. Decompose it the way
attribute access already is.
The container goes through visit_operand() because taking the expression
away from generic_visit() takes away the hoisting that kept it ordered --
without that, `assert box[identity(box := other)] == 1` would start
reading the post-walrus container. The order-axis guard in the coverage
matrix fails if this is dropped.
Slices keep the generic treatment; decomposing start/stop/step is rarely
what a failure message needs.
Closes the introspect-subscript group in the coverage matrix.1 parent 6cd2885 commit ae65813
3 files changed
Lines changed: 20 additions & 13 deletions
File tree
- changelog
- src/_pytest/assertion
- testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1119 | 1119 | | |
1120 | 1120 | | |
1121 | 1121 | | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1122 | 1137 | | |
1123 | 1138 | | |
1124 | 1139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
604 | | - | |
| 604 | + | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | 606 | | |
611 | 607 | | |
612 | 608 | | |
| |||
617 | 613 | | |
618 | 614 | | |
619 | 615 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | 616 | | |
625 | 617 | | |
626 | 618 | | |
| |||
1389 | 1381 | | |
1390 | 1382 | | |
1391 | 1383 | | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | 1384 | | |
1397 | 1385 | | |
1398 | 1386 | | |
| |||
0 commit comments