Skip to content

Commit afa486e

Browse files
committed
test raises
1 parent f6772c0 commit afa486e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sut.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ def compare(x, y):
55
return 1
66
else:
77
return -1
8+
9+
10+
def divide(x, y):
11+
return x / y

test_unittest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22

3-
from sut import compare
3+
from sut import compare, divide
44

55

66
class TestCompare(unittest.TestCase):
@@ -20,6 +20,9 @@ def test_x_less_than_y_returns_minus_1(self):
2020
def test_failing(self):
2121
self.assertEquals(compare(1, 0), 0)
2222

23+
def test_raises(self):
24+
self.assertRaises(ZeroDivisionError, divide, 1, 2)
25+
2326

2427
if __name__ == '__main__':
2528
unittest.main()

0 commit comments

Comments
 (0)