tests
This commit is contained in:
parent
4f88f30cbb
commit
02034e881e
1
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""Test package for the codeeditor application."""
|
27
tests/test_main.py
Normal file
27
tests/test_main.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user