annotate Lib/test/test_isinstance.py @ 28646:193b8aec00ce legacy-trunk

Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next.
author Guido van Rossum <guido@python.org>
date Thu, 17 Apr 2003 14:55:42 +0000
parents 19507a1d0254
children 1741af48fd9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
1 # Tests some corner cases with isinstance() and issubclass(). While these
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
2 # tests use new style classes and properties, they actually do whitebox
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
3 # testing of error conditions uncovered when using extension types.
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
4
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
5 import unittest
24364
aa0d2d51fbde Get rid of relative imports in all unittests. Now anything that
Barry Warsaw <barry@python.org>
parents: 23521
diff changeset
6 from test import test_support
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
7
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
8
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
9
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
10 class TestIsInstanceExceptions(unittest.TestCase):
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
11 # Test to make sure that an AttributeError when accessing the instance's
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
12 # class's bases is masked. This was actually a bug in Python 2.2 and
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
13 # 2.2.1 where the exception wasn't caught but it also wasn't being cleared
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
14 # (leading to an "undetected error" in the debug build). Set up is,
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
15 # isinstance(inst, cls) where:
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
16 #
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
17 # - inst isn't an InstanceType
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
18 # - cls isn't a ClassType, a TypeType, or a TupleType
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
19 # - cls has a __bases__ attribute
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
20 # - inst has a __class__ attribute
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
21 # - inst.__class__ as no __bases__ attribute
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
22 #
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
23 # Sounds complicated, I know, but this mimics a situation where an
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
24 # extension type raises an AttributeError when its __bases__ attribute is
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
25 # gotten. In that case, isinstance() should return False.
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
26 def test_class_has_no_bases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
27 class I(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
28 def getclass(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
29 # This must return an object that has no __bases__ attribute
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
30 return None
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
31 __class__ = property(getclass)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
32
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
33 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
34 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
35 return ()
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
36 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
37
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
38 self.assertEqual(False, isinstance(I(), C()))
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
39
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
40 # Like above except that inst.__class__.__bases__ raises an exception
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
41 # other than AttributeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
42 def test_bases_raises_other_than_attribute_error(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
43 class E(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
44 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
45 raise RuntimeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
46 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
47
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
48 class I(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
49 def getclass(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
50 return E()
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
51 __class__ = property(getclass)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
52
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
53 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
54 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
55 return ()
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
56 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
57
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
58 self.assertRaises(RuntimeError, isinstance, I(), C())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
59
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
60 # Here's a situation where getattr(cls, '__bases__') raises an exception.
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
61 # If that exception is not AttributeError, it should not get masked
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
62 def test_dont_mask_non_attribute_error(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
63 class I: pass
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
64
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
65 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
66 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
67 raise RuntimeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
68 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
69
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
70 self.assertRaises(RuntimeError, isinstance, I(), C())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
71
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
72 # Like above, except that getattr(cls, '__bases__') raises an
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
73 # AttributeError, which /should/ get masked as a TypeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
74 def test_mask_attribute_error(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
75 class I: pass
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
76
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
77 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
78 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
79 raise AttributeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
80 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
81
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
82 self.assertRaises(TypeError, isinstance, I(), C())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
83
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
84
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
85
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
86 # These tests are similar to above, but tickle certain code paths in
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
87 # issubclass() instead of isinstance() -- really PyObject_IsSubclass()
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
88 # vs. PyObject_IsInstance().
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
89 class TestIsSubclassExceptions(unittest.TestCase):
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
90 def test_dont_mask_non_attribute_error(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
91 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
92 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
93 raise RuntimeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
94 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
95
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
96 class S(C): pass
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
97
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
98 self.assertRaises(RuntimeError, issubclass, C(), S())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
99
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
100 def test_mask_attribute_error(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
101 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
102 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
103 raise AttributeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
104 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
105
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
106 class S(C): pass
23521
a90faa5f9417 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 23265
diff changeset
107
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
108 self.assertRaises(TypeError, issubclass, C(), S())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
109
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
110 # Like above, but test the second branch, where the __bases__ of the
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
111 # second arg (the cls arg) is tested. This means the first arg must
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
112 # return a valid __bases__, and it's okay for it to be a normal --
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
113 # unrelated by inheritance -- class.
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
114 def test_dont_mask_non_attribute_error_in_cls_arg(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
115 class B: pass
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
116
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
117 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
118 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
119 raise RuntimeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
120 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
121
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
122 self.assertRaises(RuntimeError, issubclass, B, C())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
123
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
124 def test_mask_attribute_error_in_cls_arg(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
125 class B: pass
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
126
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
127 class C(object):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
128 def getbases(self):
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
129 raise AttributeError
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
130 __bases__ = property(getbases)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
131
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
132 self.assertRaises(TypeError, issubclass, B, C())
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
133
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
134
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
135
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
136 # meta classes for creating abstract classes and instances
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
137 class AbstractClass(object):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
138 def __init__(self, bases):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
139 self.bases = bases
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
140
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
141 def getbases(self):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
142 return self.bases
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
143 __bases__ = property(getbases)
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
144
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
145 def __call__(self):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
146 return AbstractInstance(self)
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
147
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
148 class AbstractInstance(object):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
149 def __init__(self, klass):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
150 self.klass = klass
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
151
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
152 def getclass(self):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
153 return self.klass
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
154 __class__ = property(getclass)
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
155
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
156 # abstract classes
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
157 AbstractSuper = AbstractClass(bases=())
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
158
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
159 AbstractChild = AbstractClass(bases=(AbstractSuper,))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
160
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
161 # normal classes
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
162 class Super:
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
163 pass
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
164
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
165 class Child(Super):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
166 pass
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
167
26622
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
168 # new-style classes
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
169 class NewSuper(object):
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
170 pass
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
171
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
172 class NewChild(NewSuper):
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
173 pass
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
174
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
175
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
176
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
177 class TestIsInstanceIsSubclass(unittest.TestCase):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
178 # Tests to ensure that isinstance and issubclass work on abstract
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
179 # classes and instances. Before the 2.2 release, TypeErrors were
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
180 # raised when boolean values should have been returned. The bug was
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
181 # triggered by mixing 'normal' classes and instances were with
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
182 # 'abstract' classes and instances. This case tries to test all
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
183 # combinations.
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
184
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
185 def test_isinstance_normal(self):
23521
a90faa5f9417 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 23265
diff changeset
186 # normal instances
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
187 self.assertEqual(True, isinstance(Super(), Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
188 self.assertEqual(False, isinstance(Super(), Child))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
189 self.assertEqual(False, isinstance(Super(), AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
190 self.assertEqual(False, isinstance(Super(), AbstractChild))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
191
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
192 self.assertEqual(True, isinstance(Child(), Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
193 self.assertEqual(False, isinstance(Child(), AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
194
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
195 def test_isinstance_abstract(self):
23521
a90faa5f9417 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 23265
diff changeset
196 # abstract instances
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
197 self.assertEqual(True, isinstance(AbstractSuper(), AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
198 self.assertEqual(False, isinstance(AbstractSuper(), AbstractChild))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
199 self.assertEqual(False, isinstance(AbstractSuper(), Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
200 self.assertEqual(False, isinstance(AbstractSuper(), Child))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
201
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
202 self.assertEqual(True, isinstance(AbstractChild(), AbstractChild))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
203 self.assertEqual(True, isinstance(AbstractChild(), AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
204 self.assertEqual(False, isinstance(AbstractChild(), Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
205 self.assertEqual(False, isinstance(AbstractChild(), Child))
23521
a90faa5f9417 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 23265
diff changeset
206
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
207 def test_subclass_normal(self):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
208 # normal classes
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
209 self.assertEqual(True, issubclass(Super, Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
210 self.assertEqual(False, issubclass(Super, AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
211 self.assertEqual(False, issubclass(Super, Child))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
212
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
213 self.assertEqual(True, issubclass(Child, Child))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
214 self.assertEqual(True, issubclass(Child, Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
215 self.assertEqual(False, issubclass(Child, AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
216
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
217 def test_subclass_abstract(self):
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
218 # abstract classes
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
219 self.assertEqual(True, issubclass(AbstractSuper, AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
220 self.assertEqual(False, issubclass(AbstractSuper, AbstractChild))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
221 self.assertEqual(False, issubclass(AbstractSuper, Child))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
222
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
223 self.assertEqual(True, issubclass(AbstractChild, AbstractChild))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
224 self.assertEqual(True, issubclass(AbstractChild, AbstractSuper))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
225 self.assertEqual(False, issubclass(AbstractChild, Super))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
226 self.assertEqual(False, issubclass(AbstractChild, Child))
23521
a90faa5f9417 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 23265
diff changeset
227
26612
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
228 def test_subclass_tuple(self):
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
229 # test with a tuple as the second argument classes
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
230 self.assertEqual(True, issubclass(Child, (Child,)))
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
231 self.assertEqual(True, issubclass(Child, (Super,)))
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
232 self.assertEqual(False, issubclass(Super, (Child,)))
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
233 self.assertEqual(True, issubclass(Super, (Child, Super)))
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
234 self.assertEqual(False, issubclass(Child, ()))
26622
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
235 self.assertEqual(True, issubclass(Super, (Child, (Super,))))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
236
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
237 self.assertEqual(True, issubclass(NewChild, (NewChild,)))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
238 self.assertEqual(True, issubclass(NewChild, (NewSuper,)))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
239 self.assertEqual(False, issubclass(NewSuper, (NewChild,)))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
240 self.assertEqual(True, issubclass(NewSuper, (NewChild, NewSuper)))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
241 self.assertEqual(False, issubclass(NewChild, ()))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
242 self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,))))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
243
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
244 self.assertEqual(True, issubclass(int, (long, (float, int))))
19507a1d0254 Change issubclass() so that recursive tuples (directly or indirectly
Walter Dörwald <walter@livinglogic.de>
parents: 26612
diff changeset
245 self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring))))
26612
97f83542f8ee Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
Walter Dörwald <walter@livinglogic.de>
parents: 24364
diff changeset
246
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
247
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
248
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
249
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
250 def test_main():
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
251 suite = unittest.TestSuite()
23265
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
252 suite.addTest(unittest.makeSuite(TestIsInstanceExceptions))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
253 suite.addTest(unittest.makeSuite(TestIsSubclassExceptions))
8d4b25ceeefe Add more tests for abstract isinstance() and issubclass().
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 23262
diff changeset
254 suite.addTest(unittest.makeSuite(TestIsInstanceIsSubclass))
23262
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
255 test_support.run_suite(suite)
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
256
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
257
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
258 if __name__ == '__main__':
7353977d6b64 Unit tests for the changes in abstract.c version 2.101. The debug
Barry Warsaw <barry@python.org>
parents:
diff changeset
259 test_main()