Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/pytest_ci.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
Empty file added tests/__init__.py
Empty file.
14 changes: 14 additions & 0 deletions tests/test_add.py
Original file line number Diff line number Diff line change
@@ -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