From cfc43356cf3f4daa0a72f52676c92ef8d1a01c45 Mon Sep 17 00:00:00 2001 From: tjdakf Date: Fri, 10 Oct 2025 19:10:06 +0900 Subject: [PATCH 1/3] tests: Add pytest add function test #5 --- tests/__init__.py | 0 tests/test_add.py | 14 ++++++++++++++ 2 files changed, 14 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..f9406a1 --- /dev/null +++ b/tests/test_add.py @@ -0,0 +1,14 @@ +import pytest +from typing import Union + +from main import add + + +@pytest.mark.parametrize( + "a, b, expected", + [(1, 2, 3), (1.0, 2.0, 3.0), (1, 2.0, 3.0), (1.0, 2, 3.0), (0, 0, 0), (-1, -1, -2)], +) +def test_add(a: Union[int, float], b: Union[int, float], expected: Union[int, float]): + result = add(a, b) + + assert result == expected From b287a86a17b1808dce82ce8de38c15fd78db5325 Mon Sep 17 00:00:00 2001 From: tjdakf Date: Fri, 10 Oct 2025 19:11:04 +0900 Subject: [PATCH 2/3] tests: Add pytest add function test2 #5 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e079f8a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pytest From cce984a65822398c7eb06d0b076b7a8fd7ad46d4 Mon Sep 17 00:00:00 2001 From: tjdakf Date: Fri, 10 Oct 2025 19:17:26 +0900 Subject: [PATCH 3/3] tests: Add python ci workflow #5 --- .github/workflows/pytest_ci.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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..a13d4f2 --- /dev/null +++ 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