MCPcopy Index your code
hub / github.com/RustPython/RustPython / Misbehaved

Class Misbehaved

Lib/test/test_io.py:901–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899 # Make sure a `.readinto` call which returns a value outside
900 # (0, len(buffer)) raises.
901 class Misbehaved(self.RawIOBase):
902 def __init__(self, readinto_return) -> None:
903 self._readinto_return = readinto_return
904 def readinto(self, b):
905 return self._readinto_return
906
907 with self.assertRaises(ValueError) as cm:
908 Misbehaved(2).read(1)

Calls

no outgoing calls

Tested by 1