MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / MyBytes

Class MyBytes

tests_python/test_safe_repr.py:648–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646
647def test_no_repr():
648 class MyBytes(object):
649 def __init__(self, contents):
650 self.contents = contents
651 self.errored = None
652
653 def __iter__(self):
654 return iter(self.contents)
655
656 def decode(self, encoding):
657 self.errored = "decode called"
658 raise RuntimeError("Should not be called.")
659
660 def __repr__(self):
661 self.errored = "__repr__ called"
662 raise RuntimeError("Should not be called.")
663
664 def __getitem__(self, *args):
665 return self.contents.__getitem__(*args)
666
667 def __len__(self):
668 return len(self.contents)
669
670 safe_repr = SafeRepr()
671 safe_repr.string_types = (MyBytes,)

Callers 1

test_no_reprFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_no_reprFunction · 0.68