コード例 #1
0
ファイル: test_sami.py プロジェクト: ucsd-ets/pycaption
 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
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    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
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    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
ファイル: test_sami.py プロジェクト: ucsd-ets/pycaption
    def test_caption_length(self):
        captions = SAMIReader().read(SAMPLE_SAMI)

        self.assertEquals(7, len(captions.get_captions("en-US")))
コード例 #5
0
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    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
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    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
ファイル: test_sami.py プロジェクト: ucsd-ets/pycaption
 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
ファイル: test_sami.py プロジェクト: scribu/pycaption
 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
ファイル: test_sami.py プロジェクト: scribu/pycaption
    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
ファイル: test_sami.py プロジェクト: scribu/pycaption
    def test_caption_length(self):
        captions = SAMIReader().read(SAMPLE_SAMI)

        self.assertEquals(7, len(captions.get_captions("en-US")))
コード例 #13
0
ファイル: test_sami.py プロジェクト: sannies/pycaption
 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
ファイル: test_sami.py プロジェクト: sannies/pycaption
 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
ファイル: test_sami.py プロジェクト: ucsd-ets/pycaption
    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
ファイル: test_sami.py プロジェクト: ucsd-ets/pycaption
 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
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    def test_caption_length(self, sample_sami):
        captions = SAMIReader().read(sample_sami)

        assert 7 == len(captions.get_captions("en-US"))
コード例 #18
0
ファイル: test_sami.py プロジェクト: rlaphoenix/pycaption
    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')