mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Add parameters indent, width and depth to pprint.pprint() and pprint.pformat()
and pass them along to the PrettyPrinter constructor.
This commit is contained in:
parent
7a7ede54d4
commit
c8de4585a6
4 changed files with 28 additions and 10 deletions
|
@ -154,6 +154,12 @@ class QueryTestCase(unittest.TestCase):
|
|||
for type in [tuple, tuple2]:
|
||||
self.assertEqual(pprint.pformat(type(o)), exp)
|
||||
|
||||
# indent parameter
|
||||
o = range(100)
|
||||
exp = '[ %s]' % ',\n '.join(map(str, o))
|
||||
for type in [list, list2]:
|
||||
self.assertEqual(pprint.pformat(type(o), indent=4), exp)
|
||||
|
||||
def test_subclassing(self):
|
||||
o = {'names with spaces': 'should be presented using repr()',
|
||||
'others.should.not.be': 'like.this'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue