MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_basic

Method test_basic

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

Source from the content-addressed store, hash-verified

150 self.assertRaises(ValueError, pprint.PrettyPrinter, width=0)
151
152 def test_basic(self):
153 # Verify .isrecursive() and .isreadable() w/o recursion
154 pp = pprint.PrettyPrinter()
155 for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, b"def",
156 bytearray(b"ghi"), True, False, None, ...,
157 self.a, self.b):
158 # module-level convenience functions
159 self.assertFalse(pprint.isrecursive(safe),
160 "expected not isrecursive for %r" % (safe,))
161 self.assertTrue(pprint.isreadable(safe),
162 "expected isreadable for %r" % (safe,))
163 # PrettyPrinter methods
164 self.assertFalse(pp.isrecursive(safe),
165 "expected not isrecursive for %r" % (safe,))
166 self.assertTrue(pp.isreadable(safe),
167 "expected isreadable for %r" % (safe,))
168
169 def test_stdout_is_None(self):
170 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