Skip to content

Commit 9dca2c0

Browse files
alexvy86mpirnat
authored andcommitted
Explain errors to be handled in TriangleProject2 (gregmalcolm#147)
1 parent 214d87a commit 9dca2c0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

python2/koans/about_triangle_project2.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ class AboutTriangleProject2(Koan):
1111
# The first assignment did not talk about how to handle errors.
1212
# Let's handle that part now.
1313
def test_illegal_triangles_throw_exceptions(self):
14-
# Calls triangle(0, 0, 0)
14+
# In the code below, each line calls the specfied method with the arguments passed to it.
15+
# E.g. this line:
16+
# self.assertRaises(TriangleError, triangle, 0, 0, 0)
17+
# calls triangle(0, 0, 0)
18+
19+
# All sides should be greater than 0
1520
self.assertRaises(TriangleError, triangle, 0, 0, 0)
16-
1721
self.assertRaises(TriangleError, triangle, 3, 4, -5)
22+
23+
# The sum of any two sides should be greater than the third one
1824
self.assertRaises(TriangleError, triangle, 1, 1, 3)
1925
self.assertRaises(TriangleError, triangle, 2, 5, 2)

python3/koans/about_triangle_project2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ class AboutTriangleProject2(Koan):
1010
# The first assignment did not talk about how to handle errors.
1111
# Let's handle that part now.
1212
def test_illegal_triangles_throw_exceptions(self):
13+
# All sides should be greater than 0
1314
with self.assertRaises(TriangleError):
1415
triangle(0, 0, 0)
15-
1616
with self.assertRaises(TriangleError):
1717
triangle(3, 4, -5)
1818

19+
# The sum of any two sides should be greater than the third one
1920
with self.assertRaises(TriangleError):
2021
triangle(1, 1, 3)
21-
2222
with self.assertRaises(TriangleError):
2323
triangle(2, 5, 2)
2424

0 commit comments

Comments
 (0)