def test_proper_timestamps(self): captions = MicroDVDReader().read(SAMPLE_MICRODVD) paragraph = captions.get_captions(u"en-US")[2] # due to lossy nature of microsec -> frame# we check that # conversion is within a second of expected value # (fyi: timestamps in examples/ and test/samples/ differ) self.assertTrue(abs(17350000 - paragraph.start) < 10**6) self.assertTrue(abs(18752000 - paragraph.end) < 10**6)
def test_proper_timestamps(self, sample_microdvd): captions = MicroDVDReader().read(sample_microdvd) paragraph = captions.get_captions(DEFAULT_LANGUAGE_CODE)[2] # due to lossy nature of microsec -> frame# we check that # conversion is within a second of expected value # (fyi: timestamps in examples/ and tests/fixtures/ differ) assert abs(17350000 - paragraph.start) < 10**6 assert abs(18752000 - paragraph.end) < 10**6
def test_caption_length(self): captions = MicroDVDReader().read(SAMPLE_MICRODVD) self.assertEquals(12, len(captions.get_captions(u"en-US")))
def test_caption_length(self, sample_microdvd): captions = MicroDVDReader().read(sample_microdvd) assert 7 == len(captions.get_captions(DEFAULT_LANGUAGE_CODE))