Skip to content

Commit 616301e

Browse files
authored
Merge pull request #1 from phryq/feature-1
initial commit
2 parents 0728014 + 77148f7 commit 616301e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.github/workflows/python-app.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Python application
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.x'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install pytest
23+
- name: Run tests
24+
run: |
25+
pytest

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def is_even(number):
2+
"""Check if a number is even."""
3+
return number % 2 == 0

test_main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from main import is_even
3+
4+
def test_is_even_with_even_number():
5+
assert is_even(4) == True
6+
7+
def test_is_even_with_odd_number():
8+
assert is_even(5) == False
9+
10+
def test_is_even_with_zero():
11+
assert is_even(0) == True
12+
13+
def test_is_even_with_negative_even():
14+
assert is_even(-2) == True
15+
16+
def test_is_even_with_negative_odd():
17+
assert is_even(-3) == False

0 commit comments

Comments
 (0)