def test_basic(self): from unokit.adapters import InputStreamFromFileLike from hwp5_uno import inputstream_is_hwp5file from hwp5_uno import typedetect with self.open_fixture('sample-5017.hwp', 'rb') as f: inputstream = InputStreamFromFileLike(f, dontclose=True) self.assertTrue(inputstream_is_hwp5file(inputstream)) self.assertEqual('hwp5', typedetect(inputstream))
def detect(self, mediadesc): from hwp5_uno import typedetect logger.info('hwp5.Detector detect()') desc = propseq_to_dict(mediadesc) for k, v in desc.items(): logger.debug('\t%s: %s', k, v) inputstream = desc['InputStream'] typename = typedetect(inputstream) logger.info('hwp5.Detector: %s detected.', typename) return typename, mediadesc