MCPcopy Create free account
hub / github.com/numpy/numpy / BadFileLike

Class BadFileLike

numpy/lib/tests/test_loadtxt.py:850–857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848 # via the public interface (although maybe not impossible considering
849 # the current "DataClass" backing).
850 class BadFileLike:
851 counter = 0
852
853 def read(self, size):
854 self.counter += 1
855 if self.counter > 20:
856 raise RuntimeError("Bad bad bad!")
857 return "1,2,3\n"
858
859 with pytest.raises(RuntimeError, match="Bad bad bad!"):
860 np.core._multiarray_umath._load_from_filelike(

Callers 2

Calls

no outgoing calls

Tested by 2