diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e87bbcf --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""Test package for the codeeditor application.""" \ No newline at end of file diff --git a/tests/test_main.py b/tests/test_main.py new file mode 100644 index 0000000..5b8a149 --- /dev/null +++ b/tests/test_main.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""Tests for the main module.""" + +import unittest +from unittest.mock import patch +import sys +import io + +from src import main + + +class TestMain(unittest.TestCase): + """Test cases for the main module.""" + + @patch('sys.stdout', new_callable=io.StringIO) + def test_main_function(self, mock_stdout): + """Test the main function.""" + main.main() + output = mock_stdout.getvalue() + self.assertIn("Starting codeeditor application", output) + self.assertIn("Application finished", output) + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file