diff --git a/README.md b/README.md index a258773..4e59365 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,5 @@ autopep8 --in-place code/myfile.py mypy . - pylint $(git ls-files '*.py') --fail-under=8.0 - pytest --cov=. --cov-fail-under=80 \ No newline at end of file + pylint $(git ls-files '*.py') --fail-under=8.0 + pytest --cov=. --cov-fail-under=80 \ No newline at end of file diff --git a/code/calculator.py b/code/calculator.py deleted file mode 100644 index 0fa0a54..0000000 --- a/code/calculator.py +++ /dev/null @@ -1,4 +0,0 @@ -"""A simple calculator module that provides basic arithmetic operations.""" -def add(a: float, b: float) -> int: - """Add two numbers and return the result.""" - return a + b diff --git a/code/__init__.py b/src/__init__.py similarity index 100% rename from code/__init__.py rename to src/__init__.py diff --git a/src/calculator.py b/src/calculator.py new file mode 100644 index 0000000..77e1607 --- /dev/null +++ b/src/calculator.py @@ -0,0 +1,4 @@ +"""A simple calculator module that provides basic operations.""" +def add(a: float, b: float) -> float: + """Add two numbers and return the result.""" + return a + b diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 81f80c7..dabf164 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,19 +1,23 @@ -import pytest +"""Unit tests for the calculator module.""" -from code.calculator import add +from src.calculator import add def test_add_positive_numbers() -> None: + """Test adding two positive numbers.""" assert add(2, 3) == 5 def test_add_negative_numbers() -> None: + """Test adding two negative numbers.""" assert add(-2, -3) == -5 def test_add_mixed_numbers() -> None: + """Test adding a positive and a negative number.""" assert add(-2, 5) == 3 def test_add_floats() -> None: + """Test adding two floating-point numbers.""" assert add(2.5, 3.5) == 6.0