Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5dbb40f

Browse files
Added tests for more builtin types.
Made test_pprint discoverable.
1 parent 031d064 commit 5dbb40f

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

Lib/test/test_pprint.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def setUp(self):
5858
def test_basic(self):
5959
# Verify .isrecursive() and .isreadable() w/o recursion
6060
pp = pprint.PrettyPrinter()
61-
for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, "yaddayadda",
61+
for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, b"def",
62+
bytearray(b"ghi"), True, False, None,
6263
self.a, self.b):
6364
# module-level convenience functions
6465
self.assertFalse(pprint.isrecursive(safe),
@@ -128,21 +129,23 @@ def test_same_as_repr(self):
128129
# it sorted a dict display if and only if the display required
129130
# multiple lines. For that reason, dicts with more than one element
130131
# aren't tested here.
131-
for simple in (0, 0, 0+0j, 0.0, "", b"",
132+
for simple in (0, 0, 0+0j, 0.0, "", b"", bytearray(),
132133
(), tuple2(), tuple3(),
133134
[], list2(), list3(),
134135
set(), set2(), set3(),
135136
frozenset(), frozenset2(), frozenset3(),
136137
{}, dict2(), dict3(),
137138
self.assertTrue, pprint,
138-
-6, -6, -6-6j, -1.5, "x", b"x", (3,), [3], {3: 6},
139+
-6, -6, -6-6j, -1.5, "x", b"x", bytearray(b"x"),
140+
(3,), [3], {3: 6},
139141
(1,2), [3,4], {5: 6},
140142
tuple2((1,2)), tuple3((1,2)), tuple3(range(100)),
141143
[3,4], list2([3,4]), list3([3,4]), list3(range(100)),
142144
set({7}), set2({7}), set3({7}),
143145
frozenset({8}), frozenset2({8}), frozenset3({8}),
144146
dict2({5: 6}), dict3({5: 6}),
145-
range(10, -11, -1)
147+
range(10, -11, -1),
148+
True, False, None,
146149
):
147150
native = repr(simple)
148151
self.assertEqual(pprint.pformat(simple), native)
@@ -597,9 +600,5 @@ def format(self, object, context, maxlevels, level):
597600
self, object, context, maxlevels, level)
598601

599602

600-
def test_main():
601-
test.support.run_unittest(QueryTestCase)
602-
603-
604603
if __name__ == "__main__":
605-
test_main()
604+
unittest.main()

0 commit comments

Comments
 (0)