MCPcopy Index your code
hub / github.com/numpy/numpy / test_ValidGzipFile

Method test_ValidGzipFile

numpy/lib/tests/test__datasource.py:124–139  ·  view source on GitHub ↗
(self, tmp_path)

Source from the content-addressed store, hash-verified

122 assert_raises(OSError, ds.open, invalid_file)
123
124 def test_ValidGzipFile(self, tmp_path):
125 try:
126 import gzip
127 except ImportError:
128 # We don't have the gzip capabilities to test.
129 pytest.skip()
130 # Test datasource's internal file_opener for Gzip files.
131 ds = datasource.DataSource(tmp_path)
132 filepath = os.path.join(tmp_path, 'foobar.txt.gz')
133 fp = gzip.open(filepath, 'w')
134 fp.write(magic_line)
135 fp.close()
136 fp = ds.open(filepath)
137 result = fp.readline()
138 fp.close()
139 assert_equal(magic_line, result)
140
141 def test_ValidBz2File(self, tmp_path):
142 try:

Callers

nothing calls this directly

Calls 5

openMethod · 0.95
assert_equalFunction · 0.90
joinMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected