Example #1
0
    def test_not_appending_none_or_empty_captions(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(None)
        caption_list.extend([CaptionDummy(nodes=[])])

        self.assertEqual(len(caption_list), 0)
Example #2
0
    def test_appending_then_extending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(CaptionDummy(start=3))
        caption_list.extend([CaptionDummy(start=7), CaptionDummy(start=7)])

        self.assertEqual(caption_list[0].end, 7)
Example #3
0
    def test_appending_then_appending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(CaptionDummy(start=3))
        caption_list.append(CaptionDummy(start=6))

        self.assertEqual(caption_list[0].end, 6)
Example #4
0
    def test_extending_then_appending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.extend([CaptionDummy(start=4), CaptionDummy(start=4)])
        caption_list.append(CaptionDummy(start=9))

        self.assertEqual(caption_list[0].end, 9)
        self.assertEqual(caption_list[1].end, 9)
Example #5
0
    def test_extending_then_extending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.extend([CaptionDummy(start=4), CaptionDummy(start=4)])
        caption_list.extend([CaptionDummy(start=7), CaptionDummy(start=7)])

        self.assertEqual(caption_list[0].end, 7)
        self.assertEqual(caption_list[1].end, 7)
Example #6
0
    def test_not_appending_none_or_empty_captions(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(None)
        caption_list.extend([CaptionDummy(nodes=[])])

        self.assertEqual(len(caption_list), 0)
Example #7
0
    def test_appending_then_extending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(CaptionDummy(start=3))
        caption_list.extend([CaptionDummy(start=7), CaptionDummy(start=7)])

        assert caption_list[0].end == 7
Example #8
0
    def test_extending_then_appending(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.extend([CaptionDummy(start=4), CaptionDummy(start=4)])
        caption_list.append(CaptionDummy(start=9))

        assert caption_list[0].end == 9
        assert caption_list[1].end == 9
Example #9
0
    def test_not_overwriting_end_time(self):
        # Test here all the 4 cases:
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(CaptionDummy(start=1, end=3))
        caption_list.append(CaptionDummy(start=5, end=6))

        # Append then append
        self.assertEqual(caption_list[-2].end, 3)

        caption_list.extend([CaptionDummy(start=7, end=8)])

        # Append then extend
        self.assertEqual(caption_list[-2].end, 6)

        caption_list.extend([CaptionDummy(start=9, end=10)])

        # extend then extend
        self.assertEqual(caption_list[-2].end, 8)

        caption_list.append(CaptionDummy(start=11, end=12))

        # extend then append
        self.assertEqual(caption_list[-2].end, 10)
Example #10
0
    def test_not_overwriting_end_time(self):
        # Test here all the 4 cases:
        caption_list = TimingCorrectingCaptionList()

        caption_list.append(CaptionDummy(start=1, end=3))
        caption_list.append(CaptionDummy(start=5, end=6))

        # Append then append
        self.assertEqual(caption_list[-2].end, 3)

        caption_list.extend([CaptionDummy(start=7, end=8)])

        # Append then extend
        self.assertEqual(caption_list[-2].end, 6)

        caption_list.extend([CaptionDummy(start=9, end=10)])

        # extend then extend
        self.assertEqual(caption_list[-2].end, 8)

        caption_list.append(CaptionDummy(start=11, end=12))

        # extend then append
        self.assertEqual(caption_list[-2].end, 10)
Example #11
0
    def test_not_extending_list_with_nones_or_empty_captions(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.extend([None, CaptionDummy(nodes=[])])

        self.assertEqual(len(caption_list), 0)
Example #12
0
    def test_not_extending_list_with_nones_or_empty_captions(self):
        caption_list = TimingCorrectingCaptionList()

        caption_list.extend([None, CaptionDummy(nodes=[])])

        self.assertEqual(len(caption_list), 0)