MCPcopy Index your code
hub / github.com/python/cpython / test_width

Method test_width

Lib/test/test_pprint.py:451–487  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

449 self.assertEqual(pprint.pformat(o, indent=4, width=41), expected)
450
451 def test_width(self):
452 expected = """\
453[[[[[[1, 2, 3],
454 '1 2']]]],
455 {1: [1, 2, 3],
456 2: [12, 34]},
457 'abc def ghi',
458 ('ab cd ef',),
459 set2({1, 23}),
460 [[[[[1, 2, 3],
461 '1 2']]]]]"""
462 o = eval(expected)
463 self.assertEqual(pprint.pformat(o, width=15), expected)
464 self.assertEqual(pprint.pformat(o, width=16), expected)
465 self.assertEqual(pprint.pformat(o, width=25), expected)
466 self.assertEqual(pprint.pformat(o, width=14), """\
467[[[[[[1,
468 2,
469 3],
470 '1 '
471 '2']]]],
472 {1: [1,
473 2,
474 3],
475 2: [12,
476 34]},
477 'abc def '
478 'ghi',
479 ('ab cd '
480 'ef',),
481 set2({1,
482 23}),
483 [[[[[1,
484 2,
485 3],
486 '1 '
487 '2']]]]]""")
488
489 def test_integer(self):
490 self.assertEqual(pprint.pformat(1234567), '1234567')

Callers

nothing calls this directly

Calls 2

pformatMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected