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

Method test_basic

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

Source from the content-addressed store, hash-verified

167 self.assertRaises(ValueError, pprint.PrettyPrinter, compact=True, expand=True)
168
169 def test_basic(self):
170 # Verify .isrecursive() and .isreadable() w/o recursion
171 pp = pprint.PrettyPrinter()
172 for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, b"def",
173 bytearray(b"ghi"), True, False, None, ...,
174 self.a, self.b):
175 # module-level convenience functions
176 self.assertFalse(pprint.isrecursive(safe),
177 "expected not isrecursive for %r" % (safe,))
178 self.assertTrue(pprint.isreadable(safe),
179 "expected isreadable for %r" % (safe,))
180 # PrettyPrinter methods
181 self.assertFalse(pp.isrecursive(safe),
182 "expected not isrecursive for %r" % (safe,))
183 self.assertTrue(pp.isreadable(safe),
184 "expected isreadable for %r" % (safe,))
185
186 def test_stdout_is_None(self):
187 with contextlib.redirect_stdout(None):

Callers

nothing calls this directly

Calls 4

isrecursiveMethod · 0.95
isreadableMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80

Tested by

no test coverage detected