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

Method test_set_reprs

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

Source from the content-addressed store, hash-verified

870 self.assertEqual(dotted_printer.pformat(o2), exp2)
871
872 def test_set_reprs(self):
873 self.assertEqual(pprint.pformat(set()), 'set()')
874 self.assertEqual(pprint.pformat(set(range(3))), '{0, 1, 2}')
875 self.assertEqual(pprint.pformat(set(range(7)), width=20), '''\
876{0,
877 1,
878 2,
879 3,
880 4,
881 5,
882 6}''')
883 self.assertEqual(pprint.pformat(set2(range(7)), width=20), '''\
884set2({0,
885 1,
886 2,
887 3,
888 4,
889 5,
890 6})''')
891 self.assertEqual(pprint.pformat(set3(range(7)), width=20),
892 'set3({0, 1, 2, 3, 4, 5, 6})')
893
894 self.assertEqual(pprint.pformat(frozenset()), 'frozenset()')
895 self.assertEqual(pprint.pformat(frozenset(range(3))),
896 'frozenset({0, 1, 2})')
897 self.assertEqual(pprint.pformat(frozenset(range(7)), width=20), '''\
898frozenset({0,
899 1,
900 2,
901 3,
902 4,
903 5,
904 6})''')
905 self.assertEqual(pprint.pformat(frozenset2(range(7)), width=20), '''\
906frozenset2({0,
907 1,
908 2,
909 3,
910 4,
911 5,
912 6})''')
913 self.assertEqual(pprint.pformat(frozenset3(range(7)), width=20),
914 'frozenset3({0, 1, 2, 3, 4, 5, 6})')
915
916 def test_set_of_sets_reprs(self):
917 # This test creates a complex arrangement of frozensets and

Callers

nothing calls this directly

Calls 7

setFunction · 0.85
set2Class · 0.85
set3Class · 0.85
frozenset2Class · 0.85
frozenset3Class · 0.85
pformatMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected