(self)
| 589 | self.assertEqual(resulting_repr, expected_repr) |
| 590 | |
| 591 | def test_invalid_indent(self): |
| 592 | test_object = [1, 'spam', {'eggs': True, 'ham': []}] |
| 593 | test_cases = [ |
| 594 | (-1, (ValueError, '[Nn]egative|[Pp]ositive')), |
| 595 | (-4, (ValueError, '[Nn]egative|[Pp]ositive')), |
| 596 | ((), (TypeError, None)), |
| 597 | ([], (TypeError, None)), |
| 598 | ((4,), (TypeError, None)), |
| 599 | ([4,], (TypeError, None)), |
| 600 | (object(), (TypeError, None)), |
| 601 | ] |
| 602 | for indent, (expected_error, expected_msg) in test_cases: |
| 603 | with self.subTest(indent=indent): |
| 604 | r = Repr() |
| 605 | r.indent = indent |
| 606 | expected_msg = expected_msg or f'{type(indent)}' |
| 607 | with self.assertRaisesRegex(expected_error, expected_msg): |
| 608 | r.repr(test_object) |
| 609 | |
| 610 | def test_shadowed_stdlib_array(self): |
| 611 | # Issue #113570: repr() should not be fooled by an array |
nothing calls this directly
no test coverage detected