diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..38be796 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +testpaths = tests +python_files = test_*.py +python_classes = Test* +python_functions = test_* \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..7571d09 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +pytest>=7.0.0 +pytest-cov>=4.0.0 \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_sample.py b/tests/test_sample.py new file mode 100644 index 0000000..7f995be --- /dev/null +++ b/tests/test_sample.py @@ -0,0 +1,37 @@ +import unittest + +class TestSample(unittest.TestCase): + def setUp(self): + """Set up test fixtures before each test method.""" + self.test_value = 10 + + def tearDown(self): + """Clean up test fixtures after each test method.""" + pass + + def test_addition(self): + """Test basic addition.""" + self.assertEqual(1 + 1, 2) + + def test_multiplication(self): + """Test basic multiplication.""" + self.assertEqual(2 * 3, 6) + + def test_string_concatenation(self): + """Test string concatenation.""" + self.assertEqual("Hello " + "World", "Hello World") + + def test_list_operations(self): + """Test list operations.""" + test_list = [1, 2, 3] + test_list.append(4) + self.assertEqual(len(test_list), 4) + self.assertIn(4, test_list) + + def test_value_from_setup(self): + """Test using value from setUp.""" + self.assertEqual(self.test_value, 10) + self.assertGreater(self.test_value, 5) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file