• Home
  • Raw
  • Download

Lines Matching refs:pprint

7 import pprint
133 pp = pprint.PrettyPrinter()
134 pp = pprint.PrettyPrinter(indent=4, width=40, depth=5,
136 pp = pprint.PrettyPrinter(4, 40, 5, io.StringIO())
137 pp = pprint.PrettyPrinter(sort_dicts=False)
139 pp = pprint.PrettyPrinter(4, 40, 5, io.StringIO(), True)
140 self.assertRaises(ValueError, pprint.PrettyPrinter, indent=-1)
141 self.assertRaises(ValueError, pprint.PrettyPrinter, depth=0)
142 self.assertRaises(ValueError, pprint.PrettyPrinter, depth=-1)
143 self.assertRaises(ValueError, pprint.PrettyPrinter, width=0)
147 pp = pprint.PrettyPrinter()
152 self.assertFalse(pprint.isrecursive(safe),
154 self.assertTrue(pprint.isreadable(safe),
170 pp = pprint.PrettyPrinter()
173 self.assertTrue(pprint.isrecursive(icky), "expected isrecursive")
174 self.assertFalse(pprint.isreadable(icky), "expected not isreadable")
185 self.assertFalse(pprint.isrecursive(safe),
187 self.assertTrue(pprint.isreadable(safe),
197 pp = pprint.PrettyPrinter()
198 for unreadable in type(3), pprint, pprint.isrecursive:
200 self.assertFalse(pprint.isrecursive(unreadable),
202 self.assertFalse(pprint.isreadable(unreadable),
226 self.assertTrue, pprint,
239 self.assertEqual(pprint.pformat(simple), native)
240 self.assertEqual(pprint.pformat(simple, width=1, indent=0)
242 self.assertEqual(pprint.pformat(simple, underscore_numbers=True), native)
243 self.assertEqual(pprint.saferepr(simple), native)
267 self.assertEqual(pprint.pformat(cont), expected)
268 self.assertEqual(pprint.pformat(cont, width=1, indent=0), expected)
269 self.assertEqual(pprint.saferepr(cont), expected)
289 self.assertEqual(pprint.pformat(type(o)), exp)
294 self.assertEqual(pprint.pformat(type(o)), exp)
299 self.assertEqual(pprint.pformat(type(o)), exp)
305 self.assertEqual(pprint.pformat(type(o), indent=4), exp)
314 self.assertEqual(pprint.pformat(o, indent=4, width=42), expected)
320 self.assertEqual(pprint.pformat(o, indent=4, width=41), expected)
334 self.assertEqual(pprint.pformat(o, width=15), expected)
335 self.assertEqual(pprint.pformat(o, width=16), expected)
336 self.assertEqual(pprint.pformat(o, width=25), expected)
337 self.assertEqual(pprint.pformat(o, width=14), """\
361 self.assertEqual(pprint.pformat(1234567), '1234567')
362 self.assertEqual(pprint.pformat(1234567, underscore_numbers=True), '1_234_567')
370 self.assertEqual(pprint.pformat(Temperature(1000)), '1273.15°K')
378 self.assertEqual(pprint.pformat(d), "{'a': 1, 'b': 1, 'c': 1}")
379 self.assertEqual(pprint.pformat([d, d]),
387 self.assertEqual(pprint.pformat({"xy\tab\n": (3,), 5: [[]], (): {}}),
392 self.assertEqual(pprint.pformat(d, sort_dicts=False), "{'c': None, 'b': None, 'a': None}")
393 self.assertEqual(pprint.pformat([d, d], sort_dicts=False),
398 self.assertEqual(pprint.pformat(d, width=1), 'OrderedDict()')
400 self.assertEqual(pprint.pformat(d, width=1), 'OrderedDict()')
403 self.assertEqual(pprint.pformat(d),
419 self.assertEqual(pprint.pformat(m), """\
431 self.assertEqual(pprint.pformat(m), """\
444 formatted = pprint.pformat(ns)
449 formatted = pprint.pformat(ns)
464 formatted = pprint.pformat(ns, width=60, indent=4)
489 formatted = pprint.pformat(ns, width=60)
503 formatted = pprint.pformat(dc)
508 formatted = pprint.pformat(dc)
513 formatted = pprint.pformat([dc, dc], width=60, indent=4)
524 formatted = pprint.pformat(dc, width=20)
529 formatted = pprint.pformat(dc, width=10)
535 formatted = pprint.pformat(dc, width=10)
545 formatted = pprint.pformat(dc5, width=10)
571 self.assertEqual(pprint.pformat(set()), 'set()')
572 self.assertEqual(pprint.pformat(set(range(3))), '{0, 1, 2}')
573 self.assertEqual(pprint.pformat(set(range(7)), width=20), '''\
581 self.assertEqual(pprint.pformat(set2(range(7)), width=20), '''\
589 self.assertEqual(pprint.pformat(set3(range(7)), width=20),
592 self.assertEqual(pprint.pformat(frozenset()), 'frozenset()')
593 self.assertEqual(pprint.pformat(frozenset(range(3))),
595 self.assertEqual(pprint.pformat(frozenset(range(7)), width=20), '''\
603 self.assertEqual(pprint.pformat(frozenset2(range(7)), width=20), '''\
611 self.assertEqual(pprint.pformat(frozenset3(range(7)), width=20),
664 self.assertEqual(pprint.pformat(cube), cube_repr_tgt)
824 self.assertEqual(pprint.pformat(cubo), cubo_repr_tgt)
830 self.assertEqual(pprint.pformat(nested_tuple), repr(nested_tuple))
831 self.assertEqual(pprint.pformat(nested_dict), repr(nested_dict))
832 self.assertEqual(pprint.pformat(nested_list), repr(nested_list))
837 self.assertEqual(pprint.pformat(nested_tuple, depth=1), lv1_tuple)
838 self.assertEqual(pprint.pformat(nested_dict, depth=1), lv1_dict)
839 self.assertEqual(pprint.pformat(nested_list, depth=1), lv1_list)
849 self.assertEqual(clean(pprint.pformat(set(keys))),
851 self.assertEqual(clean(pprint.pformat(frozenset(keys))),
853 self.assertEqual(clean(pprint.pformat(dict.fromkeys(keys))),
857 self.assertEqual(pprint.pformat({Unorderable: 0, 1: 0}),
862 self.assertEqual(pprint.pformat(dict.fromkeys(keys, 0)),
875 self.assertEqual(pprint.pformat(set([b, a]), width=1),
877 self.assertEqual(pprint.pformat(set([a, b]), width=1),
880 self.assertEqual(pprint.pformat(dict.fromkeys([b, a]), width=1),
882 self.assertEqual(pprint.pformat(dict.fromkeys([a, b]), width=1),
888 self.assertEqual(pprint.pformat(fox, width=19), """\
892 self.assertEqual(pprint.pformat({'a': 1, 'b': fox, 'c': 2},
905 self.assertEqual(pprint.pformat(special, width=68), repr(special))
906 self.assertEqual(pprint.pformat(special, width=31), """\
910 self.assertEqual(pprint.pformat(special, width=20), """\
916 self.assertEqual(pprint.pformat([[[[[special]]]]], width=35), """\
920 self.assertEqual(pprint.pformat([[[[[special]]]]], width=25), """\
926 self.assertEqual(pprint.pformat([[[[[special]]]]], width=23), """\
935 self.assertEqual(pprint.pformat(unwrappable, width=80), repr(unwrappable))
936 self.assertEqual(pprint.pformat(''), "''")
940 formatted = pprint.pformat(special, width=width)
942 formatted = pprint.pformat([special] * 2, width=width)
955 self.assertEqual(pprint.pformat(o, width=47, compact=True), expected)
964 lines = pprint.pformat(o, width=w, compact=True).splitlines()
970 self.assertEqual(pprint.pformat(b'', width=1), "b''")
971 self.assertEqual(pprint.pformat(b'abcd', width=1), "b'abcd'")
973 self.assertEqual(pprint.pformat(letters, width=29), repr(letters))
974 self.assertEqual(pprint.pformat(letters, width=19), """\
977 self.assertEqual(pprint.pformat(letters, width=18), """\
981 self.assertEqual(pprint.pformat(letters, width=16), """\
986 self.assertEqual(pprint.pformat(special, width=61), repr(special))
987 self.assertEqual(pprint.pformat(special, width=48), """\
990 self.assertEqual(pprint.pformat(special, width=32), """\
994 self.assertEqual(pprint.pformat(special, width=1), """\
999 self.assertEqual(pprint.pformat({'a': 1, 'b': letters, 'c': 2},
1006 self.assertEqual(pprint.pformat({'a': 1, 'b': letters, 'c': 2},
1013 self.assertEqual(pprint.pformat([[[[[[letters]]]]]], width=25), """\
1016 self.assertEqual(pprint.pformat([[[[[[special]]]]]], width=41), """\
1021 formatted = pprint.pformat(special, width=width)
1023 formatted = pprint.pformat([special] * 2, width=width)
1027 self.assertEqual(pprint.pformat(bytearray(), width=1), "bytearray(b'')")
1029 self.assertEqual(pprint.pformat(letters, width=40), repr(letters))
1030 self.assertEqual(pprint.pformat(letters, width=28), """\
1033 self.assertEqual(pprint.pformat(letters, width=27), """\
1037 self.assertEqual(pprint.pformat(letters, width=25), """\
1042 self.assertEqual(pprint.pformat(special, width=72), repr(special))
1043 self.assertEqual(pprint.pformat(special, width=57), """\
1046 self.assertEqual(pprint.pformat(special, width=41), """\
1050 self.assertEqual(pprint.pformat(special, width=1), """\
1055 self.assertEqual(pprint.pformat({'a': 1, 'b': letters, 'c': 2},
1062 self.assertEqual(pprint.pformat([[[[[letters]]]]], width=37), """\
1065 self.assertEqual(pprint.pformat([[[[[special]]]]], width=50), """\
1071 self.assertEqual(pprint.pformat(d, width=1), "defaultdict(<class 'int'>, {})")
1074 self.assertEqual(pprint.pformat(d),
1089 self.assertEqual(pprint.pformat(d, width=1), "Counter()")
1091 self.assertEqual(pprint.pformat(d, width=40),
1100 self.assertEqual(pprint.pformat(d, width=1), "ChainMap({})")
1104 self.assertEqual(pprint.pformat(d),
1116 self.assertEqual(pprint.pformat(d),
1139 self.assertEqual(pprint.pformat(d, width=1), "deque([])")
1141 self.assertEqual(pprint.pformat(d, width=1), "deque([], maxlen=7)")
1144 self.assertEqual(pprint.pformat(d),
1156 self.assertEqual(pprint.pformat(d),
1169 self.assertEqual(pprint.pformat(d, width=1), "{}")
1172 self.assertEqual(pprint.pformat(d),
1186 self.assertEqual(pprint.pformat(d, width=1), "[]")
1189 self.assertEqual(pprint.pformat(d),
1203 self.assertEqual(pprint.pformat(d, width=1), "''")
1205 self.assertEqual(pprint.pformat(d, width=20),
1210 self.assertEqual(pprint.pformat({1: d}, width=20),
1218 class DottedPrettyPrinter(pprint.PrettyPrinter):
1227 return pprint.PrettyPrinter.format(