MCPcopy Create free account
hub / github.com/python/cpython / test_custom_repr_class_with_spaces

Method test_custom_repr_class_with_spaces

Lib/test/test_reprlib.py:636–650  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

634 self.assertEqual(aRepr.repr(sys.stdin), "<stdin>")
635
636 def test_custom_repr_class_with_spaces(self):
637 class TypeWithSpaces:
638 pass
639
640 t = TypeWithSpaces()
641 type(t).__name__ = "type with spaces"
642 self.assertEqual(type(t).__name__, "type with spaces")
643
644 class MyRepr(Repr):
645 def repr_type_with_spaces(self, obj, level):
646 return "Type With Spaces"
647
648
649 aRepr = MyRepr()
650 self.assertEqual(aRepr.repr(t), "Type With Spaces")
651
652def write_file(path, text):
653 with open(path, 'w', encoding='ASCII') as fp:

Callers

nothing calls this directly

Calls 4

TypeWithSpacesClass · 0.85
MyReprClass · 0.85
assertEqualMethod · 0.45
reprMethod · 0.45

Tested by

no test coverage detected