예제 #1
0
    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)
예제 #2
0
    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
예제 #3
0
    def test_caption_length(self):
        captions = MicroDVDReader().read(SAMPLE_MICRODVD)

        self.assertEquals(12, len(captions.get_captions(u"en-US")))
예제 #4
0
    def test_caption_length(self, sample_microdvd):
        captions = MicroDVDReader().read(sample_microdvd)

        assert 7 == len(captions.get_captions(DEFAULT_LANGUAGE_CODE))