def test_sami_with_p_and_span_align(self): """ <span> align DOES NOT override <p> align if it is specified inline. """ caption_set = SAMIReader().read(SAMPLE_SAMI_WITH_P_AND_SPAN_ALIGN) caption = caption_set.get_captions('en-US')[0] self.assertEquals(caption.layout_info.alignment.horizontal, HorizontalAlignmentEnum.RIGHT)
def test_proper_with_timestamps_with_multiple_paragraph( self, sample_sami_with_multiple_p): captions = SAMIReader().read(sample_sami_with_multiple_p) paragraph_1 = captions.get_captions("en-US")[0] paragraph_2 = captions.get_captions("en-US")[1] assert paragraph_1.start == paragraph_2.start assert paragraph_1.end == paragraph_2.end
def test_sami_with_p_and_span_align(self, sample_sami_with_p_and_span_align): """<span> align DOES NOT override <p> align if it is specified inline. """ caption_set = SAMIReader().read(sample_sami_with_p_and_span_align) caption = caption_set.get_captions('en-US')[0] assert caption.layout_info.alignment.horizontal == \ HorizontalAlignmentEnum.RIGHT
def test_caption_length(self): captions = SAMIReader().read(SAMPLE_SAMI) self.assertEquals(7, len(captions.get_captions("en-US")))
def test_sami_with_p_align(self, sample_sami_with_p_align): caption_set = SAMIReader().read(sample_sami_with_p_align) caption = caption_set.get_captions('en-US')[0] assert caption.layout_info.alignment.horizontal == \ HorizontalAlignmentEnum.RIGHT
def test_invalid_markup_is_properly_handled(self, sample_sami_syntax_error): captions = SAMIReader().read(sample_sami_syntax_error) assert 2 == len(captions.get_captions("en-US"))
def test_caption_length(self): captions = SAMIReader().read(SAMPLE_SAMI.decode(u"utf-8")) self.assertEquals(8, len(captions.get_captions(u"en-US")))
def test_sami_with_p_align(self): caption_set = SAMIReader().read(SAMPLE_SAMI_WITH_P_ALIGN) caption = caption_set.get_captions('en-US')[0] self.assertEquals(caption.layout_info.alignment.horizontal, HorizontalAlignmentEnum.RIGHT)
def test_caption_length(self): captions = SAMIReader().read(SAMPLE_SAMI.decode(u'utf-8')) self.assertEquals(8, len(captions.get_captions(u"en-US")))
def test_invalid_markup_is_properly_handled(self): captions = SAMIReader().read(SAMPLE_SAMI_SYNTAX_ERROR) self.assertEquals(2, len(captions.get_captions("en-US")))
def test_proper_timestamps(self): captions = SAMIReader().read(SAMPLE_SAMI) paragraph = captions.get_captions("en-US")[2] self.assertEquals(17000000, paragraph.start) self.assertEquals(18752000, paragraph.end)
def test_caption_length(self, sample_sami): captions = SAMIReader().read(sample_sami) assert 7 == len(captions.get_captions("en-US"))
def test_proper_timestamps(self, sample_sami): captions = SAMIReader().read(sample_sami) paragraph = captions.get_captions("en-US")[2] assert 17000000 == paragraph.start assert 18752000 == paragraph.end
def test_sami_with_bad_div_align(self): caption_set = SAMIReader().read(SAMPLE_SAMI_WITH_BAD_DIV_ALIGN) caption = caption_set.get_captions('en-US')[0] self.assertEquals(caption.layout_info.alignment.horizontal, u'right')