tests: Add testcases for catching user Exception subclasses.
This commit is contained in:
parent
91e556af23
commit
e276753b45
@ -5,3 +5,18 @@ e = MyExc(100, "Some error")
|
|||||||
print(e)
|
print(e)
|
||||||
print(repr(e))
|
print(repr(e))
|
||||||
print(e.args)
|
print(e.args)
|
||||||
|
|
||||||
|
try:
|
||||||
|
raise MyExc("Some error")
|
||||||
|
except MyExc as e:
|
||||||
|
print("Caught exception:", repr(e))
|
||||||
|
|
||||||
|
try:
|
||||||
|
raise MyExc("Some error2")
|
||||||
|
except Exception as e:
|
||||||
|
print("Caught exception:", repr(e))
|
||||||
|
|
||||||
|
try:
|
||||||
|
raise MyExc("Some error2")
|
||||||
|
except:
|
||||||
|
print("Caught user exception")
|
||||||
|
Loading…
Reference in New Issue
Block a user