MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_compact_width

Method test_compact_width

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

Source from the content-addressed store, hash-verified

871 self.assertEqual(pprint.pformat(o, width=47, compact=True), expected)
872
873 def test_compact_width(self):
874 levels = 20
875 number = 10
876 o = [0] * number
877 for i in range(levels - 1):
878 o = [o]
879 for w in range(levels * 2 + 1, levels + 3 * number - 1):
880 lines = pprint.pformat(o, width=w, compact=True).splitlines()
881 maxwidth = max(map(len, lines))
882 self.assertLessEqual(maxwidth, w)
883 self.assertGreater(maxwidth, w - 3)
884
885 def test_bytes_wrap(self):
886 self.assertEqual(pprint.pformat(b'', width=1), "b''")

Callers

nothing calls this directly

Calls 5

maxFunction · 0.85
pformatMethod · 0.80
assertLessEqualMethod · 0.80
assertGreaterMethod · 0.80
splitlinesMethod · 0.45

Tested by

no test coverage detected