Skip to content

Commit 82be87e

Browse files
committed
initial commit
1 parent c43344c commit 82be87e

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

requirements.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
attrs==20.1.0
2+
importlib-metadata==1.7.0
3+
iniconfig==1.0.1
4+
more-itertools==8.4.0
5+
packaging==20.4
6+
pluggy==0.13.1
7+
py==1.9.0
8+
pyparsing==2.4.7
9+
pytest==6.0.1
10+
six==1.15.0
11+
toml==0.10.1
12+
zipp==3.1.0

session.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def add_numbers(a,b):
2+
return a+b

test_session.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# import pytest
2+
import pytest
3+
4+
# import the function from your file
5+
from session import add_numbers
6+
7+
# Check if properly adds positive numbers
8+
def test_add_positive():
9+
assert add_numbers(1,2) == 3
10+
11+
# Check if properly adds zero
12+
def test_add_zero():
13+
assert add_numbers(1,0) == 1
14+
15+
# Check with negative numbers
16+
def test_add_negative():
17+
assert add_numbers(4, -100) == -96
18+
19+
# Now check if it correctly produces error when provided so
20+
def test_add_string_expect_exception():
21+
with pytest.raises(TypeError):
22+
add_numbers(4, 'I do not belong here')
23+

0 commit comments

Comments
 (0)