diff --git a/tests/stream_capture_test.py b/tests/stream_capture_test.py index d30a7c3..754fc99 100644 --- a/tests/stream_capture_test.py +++ b/tests/stream_capture_test.py @@ -1,34 +1,40 @@ +from __future__ import annotations + import unittest + from src.stream_capture import StreamCapture + class TestStreamCapture(unittest.TestCase): - + @classmethod def setUpClass(cls): # Setup - url = "tests/videos/test.mp4" + url = 'tests/videos/test.mp4' capture_interval = 15 cls.stream_capture = StreamCapture(url, capture_interval) - + def test_initialisation(self): self.assertIsInstance(self.stream_capture, StreamCapture) - + def test_capture_interval_update(self): new_interval = 10 self.stream_capture.update_capture_interval(new_interval) self.assertEqual(self.stream_capture.capture_interval, new_interval) - + def test_select_quality_based_on_speed(self): stream_url = self.stream_capture.select_quality_based_on_speed() self.assertIsInstance(stream_url, (str, type(None))) - + def test_check_internet_speed(self): - download_speed, upload_speed = self.stream_capture.check_internet_speed() + download_speed, upload_speed = ( + self.stream_capture.check_internet_speed() + ) self.assertIsInstance(download_speed, float) self.assertIsInstance(upload_speed, float) self.assertGreaterEqual(download_speed, 0) self.assertGreaterEqual(upload_speed, 0) - + def test_execute_capture(self): generator = self.stream_capture.execute_capture() self.assertTrue(hasattr(generator, '__iter__')) @@ -39,11 +45,12 @@ def test_execute_capture(self): # Release resources del frame self.stream_capture.release_resources() - + @classmethod def tearDownClass(cls): # Teardown or release resources if needed cls.stream_capture.release_resources() + if __name__ == '__main__': unittest.main()