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

Method check_compressed

numpy/lib/tests/test_io.py:641–655  ·  view source on GitHub ↗
(self, fopen, suffixes)

Source from the content-addressed store, hash-verified

639
640class LoadTxtBase:
641 def check_compressed(self, fopen, suffixes):
642 # Test that we can load data from a compressed file
643 wanted = np.arange(6).reshape((2, 3))
644 linesep = ('\n', '\r\n', '\r')
645 for sep in linesep:
646 data = '0 1 2' + sep + '3 4 5'
647 for suffix in suffixes:
648 with temppath(suffix=suffix) as name:
649 with fopen(name, mode='wt', encoding='UTF-32-LE') as f:
650 f.write(data)
651 res = self.loadfunc(name, encoding='UTF-32-LE')
652 assert_array_equal(res, wanted)
653 with fopen(name, "rt", encoding='UTF-32-LE') as f:
654 res = self.loadfunc(f)
655 assert_array_equal(res, wanted)
656
657 def test_compressed_gzip(self):
658 self.check_compressed(gzip.open, ('.gz',))

Callers 3

test_compressed_gzipMethod · 0.95
test_compressed_bz2Method · 0.95
test_compressed_lzmaMethod · 0.95

Calls 4

temppathFunction · 0.90
assert_array_equalFunction · 0.90
reshapeMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected