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