Content-Length: 286050 | pFad | http://github.com/MrRezoo/python-testing/commit/391282ec9add558abb3a37ba085cd0fd10aeed4d

26 pytest add Exception handler · MrRezoo/python-testing@391282e · GitHub
Skip to content

Commit 391282e

Browse files
committed
pytest add Exception handler
1 parent 5df36f5 commit 391282e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test_pytest_exception_handler.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import pytest
2+
import sample_func
3+
4+
5+
def test_add():
6+
assert sample_func.add(3, 4) == 7
7+
assert sample_func.add(-1, 4) == 3
8+
assert sample_func.add(0, 4) == 4
9+
10+
11+
def subtract():
12+
assert sample_func.subtract(3, 4) == -1
13+
assert sample_func.subtract(-1, 4) == -5
14+
assert sample_func.subtract(0, 4) == -4
15+
16+
17+
def multiply():
18+
assert sample_func.multiply(3, 4) == 12
19+
assert sample_func.multiply(3, 4) != 11
20+
assert sample_func.multiply(-1, 4) == -4
21+
assert sample_func.multiply(0, 4) == 0
22+
23+
24+
def division():
25+
assert sample_func.multiply(12, 4) == 3
26+
with pytest.raises(ZeroDivisionError):
27+
sample_func.division(2, 0)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/MrRezoo/python-testing/commit/391282ec9add558abb3a37ba085cd0fd10aeed4d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy