Beispiel #1
0
 def test_changeDisallowsChangingStartToNone(self):
     ft = FrameTimeMock(17)
     sub = Subtitle(start = ft)
     sub.change(start = None)
     self.assertEqual(ft, sub.start)
Beispiel #2
0
 def test_changeDisallowsChangingEndToNone(self):
     ft = FrameTimeMock(19)
     sub = Subtitle(end = ft)
     sub.change(end = None)
     self.assertEqual(ft, sub.end)
Beispiel #3
0
 def test_changeEndCorrectly(self):
     sub = Subtitle(end = FrameTimeMock(11))
     ft = FrameTimeMock(14)
     sub.change(end = ft)
     self.assertEqual(ft, sub.end)
Beispiel #4
0
 def test_changeTextCorrectly(self):
     sub = Subtitle(text = "string")
     sub.change(text = "Subtitle")
     self.assertEqual("Subtitle", sub.text)
Beispiel #5
0
 def test_emptyReturnsFalseWhenTextIsSet(self):
     sub = Subtitle(text = "text")
     self.assertFalse(sub.empty())
Beispiel #6
0
 def test_changeStartCorrectly(self):
     sub = Subtitle(start = FrameTimeMock(10))
     ft = FrameTimeMock(15)
     sub.change(start = ft)
     self.assertEqual(ft, sub.start)
Beispiel #7
0
 def test_emptyReturnsFalseWhenStartIsSet(self):
     ft = FrameTimeMock(22.0)
     sub = Subtitle(start = ft)
     self.assertFalse(sub.empty())
Beispiel #8
0
 def test_emptyReturnsFalseWhenEndIsSet(self):
     ft = FrameTimeMock(21.0)
     sub = Subtitle(end = ft)
     self.assertFalse(sub.empty())
Beispiel #9
0
 def test_SubtitleDisallowChangingEndToADifferentFpsThanStart(self):
     sub = Subtitle(start = FrameTimeMock(15), end = FrameTimeMock(15))
     with self.assertRaises(ValueError):
         sub.change(end = FrameTimeMock(29))
Beispiel #10
0
 def test_SubtitleDisallowSettingStartAndEndWithDifferentFpsValues(self):
     sub = Subtitle(start = FrameTimeMock(17), end = FrameTimeMock(17))
     with self.assertRaises(ValueError):
         sub.change(start = FrameTimeMock(37), end = FrameTimeMock(26))
Beispiel #11
0
 def test_fpsDoesntChangeEndWhenItIsNone(self):
     sub = Subtitle(start = FrameTimeMock(14))
     sub.fps = 9
     self.assertIsNone(sub.end)
Beispiel #12
0
 def test_fpsDoesntChangeStartWhenItIsNone(self):
     sub = Subtitle(end = FrameTimeMock(13))
     sub.fps = 10
     self.assertIsNone(sub.start)
Beispiel #13
0
 def test_fpsCorrectlyChangesFpsForEnd(self):
     ftStart = FrameTimeMock(12)
     ftEnd = FrameTimeMock(12)
     sub = Subtitle(start = ftStart, end = ftEnd)
     sub.fps = 23
     self.assertEqual(23, sub.end.fps)
Beispiel #14
0
 def test_fpsCorrectlyChangesFpsForStart(self):
     ftStart = FrameTimeMock(10)
     ftEnd = FrameTimeMock(10)
     sub = Subtitle(start = ftStart, end = ftEnd)
     sub.fps = 25
     self.assertEqual(25, sub.start.fps)
Beispiel #15
0
 def test_changeDisallowsChangingTextToNone(self):
     sub = Subtitle(text = "My Subtitle")
     sub.change(text = None)
     self.assertEqual("My Subtitle", sub.text)