File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ def add_numbers (a ,b ):
2
+ return a + b
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments