|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 |
|
3 | 3 | import collections |
| 4 | +import contextlib |
4 | 5 | import dataclasses |
5 | 6 | import io |
6 | 7 | import itertools |
@@ -159,6 +160,13 @@ def test_basic(self): |
159 | 160 | self.assertTrue(pp.isreadable(safe), |
160 | 161 | "expected isreadable for %r" % (safe,)) |
161 | 162 |
|
| 163 | + def test_stdout_is_None(self): |
| 164 | + with contextlib.redirect_stdout(None): |
| 165 | + # smoke test - there is no output to check |
| 166 | + value = 'this should not fail' |
| 167 | + pprint.pprint(value) |
| 168 | + pprint.PrettyPrinter().pprint(value) |
| 169 | + |
162 | 170 | def test_knotted(self): |
163 | 171 | # Verify .isrecursive() and .isreadable() w/ recursion |
164 | 172 | # Tie a knot. |
@@ -195,7 +203,7 @@ def test_knotted(self): |
195 | 203 | def test_unreadable(self): |
196 | 204 | # Not recursive but not readable anyway |
197 | 205 | pp = pprint.PrettyPrinter() |
198 | | - for unreadable in type(3), pprint, pprint.isrecursive: |
| 206 | + for unreadable in object(), int, pprint, pprint.isrecursive: |
199 | 207 | # module-level convenience functions |
200 | 208 | self.assertFalse(pprint.isrecursive(unreadable), |
201 | 209 | "expected not isrecursive for %r" % (unreadable,)) |
@@ -524,6 +532,8 @@ def test_dataclass_with_repr(self): |
524 | 532 | formatted = pprint.pformat(dc, width=20) |
525 | 533 | self.assertEqual(formatted, "custom repr that doesn't fit within pprint width") |
526 | 534 |
|
| 535 | + # TODO: RUSTPYTHON |
| 536 | + @unittest.expectedFailure |
527 | 537 | def test_dataclass_no_repr(self): |
528 | 538 | dc = dataclass3() |
529 | 539 | formatted = pprint.pformat(dc, width=10) |
|
0 commit comments