MCPcopy Index your code
hub / github.com/python/cpython / test_custom_repr

Method test_custom_repr

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

Source from the content-addressed store, hash-verified

623 self.assertEqual(r(list()), "not builtins.list")
624
625 def test_custom_repr(self):
626 class MyRepr(Repr):
627
628 def repr_TextIOWrapper(self, obj, level):
629 if obj.name in {'<stdin>', '<stdout>', '<stderr>'}:
630 return obj.name
631 return repr(obj)
632
633 aRepr = MyRepr()
634 self.assertEqual(aRepr.repr(sys.stdin), "<stdin>")
635
636 def test_custom_repr_class_with_spaces(self):
637 class TypeWithSpaces:

Callers

nothing calls this directly

Calls 3

MyReprClass · 0.85
assertEqualMethod · 0.45
reprMethod · 0.45

Tested by

no test coverage detected