Commit b8c5717
committed
Fix: Preserve dict insertion order in assertion output
Remove sorted() calls in PrettyPrinter to preserve dict insertion order.
Since Python 3.7+, dicts maintain insertion order. Sorting keys
alphabetically in assertion failures is confusing and doesn't match
how Python naturally displays dicts.
Changes:
- _pprint_dict: Remove sorted() on object.items()
- _safe_repr: Remove sorted() on dict.items() iteration
Fixes #135031 parent d794da3 commit b8c5717
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
0 commit comments