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

Method test_ValidBz2File

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

Source from the content-addressed store, hash-verified

139 assert_equal(magic_line, result)
140
141 def test_ValidBz2File(self, tmp_path):
142 try:
143 import bz2
144 except ImportError:
145 # We don't have the bz2 capabilities to test.
146 pytest.skip()
147 # Test datasource's internal file_opener for BZip2 files.
148 ds = datasource.DataSource(tmp_path)
149 filepath = os.path.join(tmp_path, 'foobar.txt.bz2')
150 fp = bz2.BZ2File(filepath, 'w')
151 fp.write(magic_line)
152 fp.close()
153 fp = ds.open(filepath)
154 result = fp.readline()
155 fp.close()
156 assert_equal(magic_line, result)
157
158
159class TestDataSourceExists:

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