From 9e2929f13796fb78bc9a1153d3b2967f3595612b Mon Sep 17 00:00:00 2001 From: betapa Date: Sat, 29 Mar 2025 16:55:11 +0900 Subject: [PATCH 1/5] tests: Add pytest add function test #5 --- tests/__init__.py | 0 tests/test_add.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_add.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_add.py b/tests/test_add.py new file mode 100644 index 0000000..56331b8 --- /dev/null +++ b/tests/test_add.py @@ -0,0 +1,17 @@ +import pytest +from typing import Union + +from main import add + + +@pytest.mark.parametrize( + "a, b, expected", + [ + (1, 2, 3), # Test with two integers + (1.5, 2.5, 4.0), # Test with two floats + (1, 2.5, 3.5), # Test with int and float + (1.5, 2, 3.5), # Test with float and int + ], +) +def test_add(a: Union[int, float], b: Union[int, float], expected: Union[int, float]): + assert add(a, b) == expected From fb5b1367cb26919d6c8bb0424b8ee1ee3e8d327f Mon Sep 17 00:00:00 2001 From: betapa Date: Sat, 29 Mar 2025 16:55:35 +0900 Subject: [PATCH 2/5] tests: Add pytest add function test #5 --- requirements.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 From c8e5cdb37227757cb699b1f9f32d588d80886ae9 Mon Sep 17 00:00:00 2001 From: betapa Date: Sat, 29 Mar 2025 17:01:37 +0900 Subject: [PATCH 3/5] tests: Add python ci workflow #5 --- .github/workflows/pytest_ci.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/pytest_ci.yaml diff --git a/.github/workflows/pytest_ci.yaml b/.github/workflows/pytest_ci.yaml new file mode 100644 index 0000000..e69de29 From 055b1933fa78327d8f22d64a482688a8a5a6b081 Mon Sep 17 00:00:00 2001 From: betapa Date: Sat, 29 Mar 2025 17:07:13 +0900 Subject: [PATCH 4/5] tests: Add python ci workflow #5 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index e69de29..e079f8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +pytest From 7b7e1407c5df1ef529e8034b20e11c06514466c7 Mon Sep 17 00:00:00 2001 From: betapa Date: Sat, 29 Mar 2025 17:07:22 +0900 Subject: [PATCH 5/5] tests: Add python ci workflow #5 --- .github/workflows/pytest_ci.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/pytest_ci.yaml b/.github/workflows/pytest_ci.yaml index e69de29..a13d4f2 100644 --- a/.github/workflows/pytest_ci.yaml +++ b/.github/workflows/pytest_ci.yaml @@ -0,0 +1,26 @@ +name: Python CI + +on: push + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + architecture: x64 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tests with pytest + run: | + python -m pytest