Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2234c3f

Browse files
committed
tests: Add test for exception matching of a tuple of exceptions.
1 parent 4bcd04b commit 2234c3f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/basics/except_match_tuple.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# test exception matching against a tuple
2+
3+
try:
4+
fail
5+
except (Exception,):
6+
print('except 1')
7+
8+
try:
9+
fail
10+
except (Exception, Exception):
11+
print('except 2')
12+
13+
try:
14+
fail
15+
except (TypeError, NameError):
16+
print('except 3')
17+
18+
try:
19+
fail
20+
except (TypeError, ValueError, Exception):
21+
print('except 4')

0 commit comments

Comments
 (0)