MCPcopy Create free account
hub / github.com/ahupp/python-magic / test_keep_going

Method test_keep_going

test/python_magic_test.py:180–194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

178 del os.environ['MAGIC']
179
180 def test_keep_going(self):
181 filename = os.path.join(self.TESTDATA_DIR, 'keep-going.jpg')
182
183 m = magic.Magic(mime=True)
184 self.assertEqual(m.from_file(filename), 'image/jpeg')
185
186 try:
187 # this will throw if you have an "old" version of the library
188 # I'm otherwise not sure how to query if keep_going is supported
189 magic.version()
190 m = magic.Magic(mime=True, keep_going=True)
191 self.assertEqual(m.from_file(filename),
192 'image/jpeg\\012- application/octet-stream')
193 except NotImplementedError:
194 pass
195
196 def test_rethrow(self):
197 old = magic.magic_buffer

Callers

nothing calls this directly

Calls 1

from_fileMethod · 0.95

Tested by

no test coverage detected