tests: Add test for exception matching of a tuple of exceptions.
This commit is contained in:
parent
4bcd04bcad
commit
2234c3f23d
21
tests/basics/except_match_tuple.py
Normal file
21
tests/basics/except_match_tuple.py
Normal file
@ -0,0 +1,21 @@
|
||||
# test exception matching against a tuple
|
||||
|
||||
try:
|
||||
fail
|
||||
except (Exception,):
|
||||
print('except 1')
|
||||
|
||||
try:
|
||||
fail
|
||||
except (Exception, Exception):
|
||||
print('except 2')
|
||||
|
||||
try:
|
||||
fail
|
||||
except (TypeError, NameError):
|
||||
print('except 3')
|
||||
|
||||
try:
|
||||
fail
|
||||
except (TypeError, ValueError, Exception):
|
||||
print('except 4')
|
Loading…
Reference in New Issue
Block a user