Esempio n. 1
0
 def test_changeDisallowsChangingStartToNone(self):
     ft = FrameTimeMock(17)
     sub = Subtitle(start = ft)
     sub.change(start = None)
     self.assertEqual(ft, sub.start)
Esempio n. 2
0
 def test_changeDisallowsChangingEndToNone(self):
     ft = FrameTimeMock(19)
     sub = Subtitle(end = ft)
     sub.change(end = None)
     self.assertEqual(ft, sub.end)
Esempio n. 3
0
 def test_changeEndCorrectly(self):
     sub = Subtitle(end = FrameTimeMock(11))
     ft = FrameTimeMock(14)
     sub.change(end = ft)
     self.assertEqual(ft, sub.end)
Esempio n. 4
0
 def test_changeTextCorrectly(self):
     sub = Subtitle(text = "string")
     sub.change(text = "Subtitle")
     self.assertEqual("Subtitle", sub.text)
Esempio n. 5
0
 def test_emptyReturnsFalseWhenTextIsSet(self):
     sub = Subtitle(text = "text")
     self.assertFalse(sub.empty())
Esempio n. 6
0
 def test_changeStartCorrectly(self):
     sub = Subtitle(start = FrameTimeMock(10))
     ft = FrameTimeMock(15)
     sub.change(start = ft)
     self.assertEqual(ft, sub.start)
Esempio n. 7
0
 def test_emptyReturnsFalseWhenStartIsSet(self):
     ft = FrameTimeMock(22.0)
     sub = Subtitle(start = ft)
     self.assertFalse(sub.empty())
Esempio n. 8
0
 def test_emptyReturnsFalseWhenEndIsSet(self):
     ft = FrameTimeMock(21.0)
     sub = Subtitle(end = ft)
     self.assertFalse(sub.empty())
Esempio n. 9
0
 def test_SubtitleDisallowChangingEndToADifferentFpsThanStart(self):
     sub = Subtitle(start = FrameTimeMock(15), end = FrameTimeMock(15))
     with self.assertRaises(ValueError):
         sub.change(end = FrameTimeMock(29))
Esempio n. 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))
Esempio n. 11
0
 def test_fpsDoesntChangeEndWhenItIsNone(self):
     sub = Subtitle(start = FrameTimeMock(14))
     sub.fps = 9
     self.assertIsNone(sub.end)
Esempio n. 12
0
 def test_fpsDoesntChangeStartWhenItIsNone(self):
     sub = Subtitle(end = FrameTimeMock(13))
     sub.fps = 10
     self.assertIsNone(sub.start)
Esempio n. 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)
Esempio n. 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)
Esempio n. 15
0
 def test_changeDisallowsChangingTextToNone(self):
     sub = Subtitle(text = "My Subtitle")
     sub.change(text = None)
     self.assertEqual("My Subtitle", sub.text)