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

Method test_width

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

Source from the content-addressed store, hash-verified

334 self.assertEqual(pprint.pformat(o, indent=4, width=41), expected)
335
336 def test_width(self):
337 expected = """\
338[[[[[[1, 2, 3],
339 '1 2']]]],
340 {1: [1, 2, 3],
341 2: [12, 34]},
342 'abc def ghi',
343 ('ab cd ef',),
344 set2({1, 23}),
345 [[[[[1, 2, 3],
346 '1 2']]]]]"""
347 o = eval(expected)
348 self.assertEqual(pprint.pformat(o, width=15), expected)
349 self.assertEqual(pprint.pformat(o, width=16), expected)
350 self.assertEqual(pprint.pformat(o, width=25), expected)
351 self.assertEqual(pprint.pformat(o, width=14), """\
352[[[[[[1,
353 2,
354 3],
355 '1 '
356 '2']]]],
357 {1: [1,
358 2,
359 3],
360 2: [12,
361 34]},
362 'abc def '
363 'ghi',
364 ('ab cd '
365 'ef',),
366 set2({1,
367 23}),
368 [[[[[1,
369 2,
370 3],
371 '1 '
372 '2']]]]]""")
373
374 def test_integer(self):
375 self.assertEqual(pprint.pformat(1234567), '1234567')

Callers

nothing calls this directly

Calls 3

pformatMethod · 0.80
evalFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected