def test_junk_after_timestamp(self): item = WebVTTItem.from_string(self.junk_after_timestamp) self.assertEquals(item, self.item)
def test_string_index(self): item = WebVTTItem.from_string(self.string_index) self.assertEquals(item.index, 'foo') self.assertEquals(item.text, 'Hello !')
def test_no_index(self): item = WebVTTItem.from_string(self.no_index) self.assertEquals(item.index, None) self.assertEquals(item.text, 'Hello world !')
def test_idempotence(self): vtt = WebVTTItem.from_string(self.vtt) self.assertEqual(str(vtt), self.vtt) item = WebVTTItem.from_string(self.coordinates) self.assertEqual(str(item), self.coordinates[2:])
def test_dots(self): self.assertEqual(WebVTTItem.from_string(self.dots), self.item)
def test_coordinates(self): item = WebVTTItem.from_string(self.coordinates) self.assertEqual(item, self.item) self.assertEqual(item.position, 'X1:000 X2:000 Y1:050 Y2:100')
def test_vtt_positioning(self): vtt = WebVTTItem.from_string(self.vtt) self.assertEqual(vtt.position, 'D:vertical A:start L:12%') self.assertEqual(vtt.index, None) self.assertEqual(vtt.text, 'Hello world !')
def test_from_string(self): self.assertEqual(WebVTTItem.from_string(self.string), self.item) self.assertRaises(InvalidItem, WebVTTItem.from_string, self.bad_string)