Add and update test cases
authorJakob Cornell <jakob@jcornell.net>
Sat, 4 Jan 2020 04:47:31 +0000 (22:47 -0600)
committerJakob Cornell <jakob@jcornell.net>
Sat, 4 Jan 2020 04:47:31 +0000 (22:47 -0600)
hls_watch/test.py

index aac9fe18d62068f01b9693b38129de293fc1488a..63d9f65fa22ccba0856931b49579956c1eaf1286 100644 (file)
@@ -66,7 +66,7 @@ class TestCases(unittest.TestCase):
                        ]
                )
 
-       def test_static_mid(self):
+       def test_no_sync(self):
                self._run_case(
                        [
                                [
@@ -116,6 +116,17 @@ class TestCases(unittest.TestCase):
                                        Segment('seg104', 12),
                                        Segment('seg105', 12),
                                ],
+                               [
+                                       M3u(),
+                                       Version(3),
+                                       TargDur(15),
+                                       MediaSeq(102),
+                                       Segment('seg102', 15),
+                                       Segment('seg103', 12),
+                                       Segment('seg104', 12),
+                                       Segment('seg105', 12),
+                                       Segment('seg106', 12),
+                               ],
                        ],
                        [
                                [
@@ -126,12 +137,13 @@ class TestCases(unittest.TestCase):
                                        Segment('seg103', 12),
                                        Segment('seg104', 12),
                                        Segment('seg105', 12),
+                                       Segment('seg106', 12),
                                        Endlist(),
                                ],
                        ]
                )
 
-       def test_media_seq(self):
+       def test_zero_media_seq(self):
                self._run_case(
                        [
                                [
@@ -290,6 +302,27 @@ class TestCases(unittest.TestCase):
                        ]
                )
 
+       def test_bad_targ_dur(self):
+               with self.assertRaises(ValueError):
+                       self._run_case(
+                               [
+                                       [
+                                               M3u(),
+                                               Version(3),
+                                               TargDur(12),
+                                               Segment('seg-0', 10),
+                                       ],
+                                       [
+                                               M3u(),
+                                               Version(3),
+                                               TargDur(15),
+                                               MediaSeq(1),
+                                               Segment('seg-1', 10),
+                                       ],
+                               ],
+                               []
+                       )
+
 
 if __name__ == '__main__':
        unittest.main()