Skip to content

Commit d7f7ae4

Browse files
author
krsm
committed
Adding exception handler
1 parent 7a83095 commit d7f7ae4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Unitests/pystest_stdy/test_capitalize.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ def test_capitalize_string():
1414
c = capitalize.capitalize_string('pytest')
1515
assert c == 'Pytest'
1616

17+
18+
# custom exception
19+
def test_raises_exception_string_argument():
20+
# pytest.raises will raise a TypeError in case
21+
# the argument passed is not a string
22+
with pytest.raises(TypeError):
23+
capitalize.capitalize_string(10)

0 commit comments

Comments
 (0)