blob: d8e0e2d3240342ad3ca8706b6e271e522b12cb13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
"""test non-exceptions catched
"""
import socket
__revision__ = 1
class MyException(object):
""" custom 'exception' """
pass
class MySecondException(object):
""" custom 'exception' """
pass
class MyGoodException(Exception):
""" custom 'exception' """
pass
class MySecondGoodException(MyGoodException):
""" custom 'exception' """
pass
class SkipException(socket.error):
""" This gave false positives for Python 2,
but not for Python 3, due to exception
hierarchy rewrite.
"""
class SecondSkipException(SkipException):
""" This too shouldn't give false
positives. """
try:
1 + 1
except MyException:
print "oups"
try:
1 + 2
except (MyException, MySecondException):
print "oups"
try:
1 + 3
except MyGoodException:
print "should work"
try:
1 + 3
except (MyGoodException, MySecondGoodException):
print "should work"
try:
1 + 3
except (SkipException, SecondSkipException):
print "should work"
|