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

        self.assertEquals(7, len(captions.get_captions("en-US")))
예제 #5
0
    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
예제 #6
0
    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"))
예제 #7
0
파일: test_sami.py 프로젝트: vhx/pycaption
    def test_caption_length(self):
        captions = SAMIReader().read(SAMPLE_SAMI.decode(u"utf-8"))

        self.assertEquals(8, len(captions.get_captions(u"en-US")))
예제 #8
0
 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)
예제 #9
0
    def test_caption_length(self):
        captions = SAMIReader().read(SAMPLE_SAMI.decode(u'utf-8'))

        self.assertEquals(8, len(captions.get_captions(u"en-US")))
예제 #10
0
 def test_invalid_markup_is_properly_handled(self):
     captions = SAMIReader().read(SAMPLE_SAMI_SYNTAX_ERROR)
     self.assertEquals(2, len(captions.get_captions("en-US")))
예제 #11
0
    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)
예제 #12
0
    def test_caption_length(self):
        captions = SAMIReader().read(SAMPLE_SAMI)

        self.assertEquals(7, len(captions.get_captions("en-US")))
예제 #13
0
 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)
예제 #14
0
 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)
예제 #15
0
    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)
예제 #16
0
 def test_invalid_markup_is_properly_handled(self):
     captions = SAMIReader().read(SAMPLE_SAMI_SYNTAX_ERROR)
     self.assertEquals(2, len(captions.get_captions("en-US")))
예제 #17
0
    def test_caption_length(self, sample_sami):
        captions = SAMIReader().read(sample_sami)

        assert 7 == len(captions.get_captions("en-US"))
예제 #18
0
    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
예제 #19
0
파일: test_sami.py 프로젝트: yol/pycaption
 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')