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

Method test_ValidBz2File

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

Source from the content-addressed store, hash-verified

139 assert_equal(magic_line, result)
140
141 def test_ValidBz2File(self):
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 filepath = os.path.join(self.tmpdir, 'foobar.txt.bz2')
149 fp = bz2.BZ2File(filepath, 'w')
150 fp.write(magic_line)
151 fp.close()
152 fp = self.ds.open(filepath)
153 result = fp.readline()
154 fp.close()
155 assert_equal(magic_line, result)
156
157
158class TestDataSourceExists:

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected