Skip to content

Commit 3eea881

Browse files
committed
Add example test for exception
1 parent 0ff5a30 commit 3eea881

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source-code/testing/DocTest/point.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def __init__(self, x_value, y_value):
2222
--------
2323
>>> Point(3.1, 5.6)
2424
(3.1, 5.6)
25+
>>> Point('a', 'b') # doctest: +IGNORE_EXCEPTION_DETAIL
26+
Traceback (most recent call last):
27+
ValueError: could not convert string to float: 'a'
2528
'''
2629
self._x = float(x_value)
2730
self._y = float(y_value)
@@ -166,7 +169,7 @@ def __repr__(self):
166169
--------
167170
>>> p = Point(3.1, 5.6)
168171
>>> repr(p)
169-
(3.1, 5.6)
172+
'(3.1, 5.6)'
170173
'''
171174
return f'({self.x}, {self.y})'
172175

0 commit comments

Comments
 (0)