gh-89722: Add tests for pprint.pprint#95281
Conversation
…derscore_numbers arguments
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
| 'third': 3}]""" | ||
| self.assertEqual(pprint.pformat(o, indent=4, width=41), expected) | ||
|
|
||
| expected = "[ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n" \ |
There was a problem hiding this comment.
I think you can write a helper function, something like assert_pprint(self, obj, expected, indent=1, width=80, depth=None) (mirroring the defaults of pprint.pprint), that then tests both pprint.pformat to a string and pprint,pprint to a stream. Then use it everywhere instead of duplicating the expected values everywhere. You'll probably need to ignore the trailing newline on the stream version.
|
The full signature would probably be |
|
@hp310780 thanks for your contribution. Any plans to continue your work on it? |
Hi there! Many apologies, I was restricted from open source due to some work legalities, but this is no longer the case. I see that this PR is still active with other contributions. Should I continue? |
That's not a problem, no pressure here :) It would be great if you can continue. |
|
This PR is stale because it has been open for 30 days with no activity. |
Add tests for pprint.pprint arguments indent, width, depth, compact, sort_dicts and underscore_numbers.