From 02034e881e60896ba24d85a6551cc613bc087da1 Mon Sep 17 00:00:00 2001 From: Niklas Peng Date: Fri, 30 May 2025 19:51:58 +0200 Subject: [PATCH] tests --- tests/__init__.py | 1 + tests/test_main.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_main.py 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