Back to index

python3.2  3.2.2
Public Member Functions
test.test_isinstance.TestIsInstanceIsSubclass Class Reference

List of all members.

Public Member Functions

def test_isinstance_normal
def test_isinstance_abstract
def test_subclass_normal
def test_subclass_abstract
def test_subclass_tuple
def test_subclass_recursion_limit
def test_isinstance_recursion_limit

Detailed Description

Definition at line 191 of file test_isinstance.py.


Member Function Documentation

Definition at line 209 of file test_isinstance.py.

00209 
00210     def test_isinstance_abstract(self):
00211         # abstract instances
00212         self.assertEqual(True, isinstance(AbstractSuper(), AbstractSuper))
00213         self.assertEqual(False, isinstance(AbstractSuper(), AbstractChild))
00214         self.assertEqual(False, isinstance(AbstractSuper(), Super))
00215         self.assertEqual(False, isinstance(AbstractSuper(), Child))
00216 
00217         self.assertEqual(True, isinstance(AbstractChild(), AbstractChild))
00218         self.assertEqual(True, isinstance(AbstractChild(), AbstractSuper))
00219         self.assertEqual(False, isinstance(AbstractChild(), Super))
00220         self.assertEqual(False, isinstance(AbstractChild(), Child))

Here is the call graph for this function:

Definition at line 199 of file test_isinstance.py.

00199 
00200     def test_isinstance_normal(self):
00201         # normal instances
00202         self.assertEqual(True, isinstance(Super(), Super))
00203         self.assertEqual(False, isinstance(Super(), Child))
00204         self.assertEqual(False, isinstance(Super(), AbstractSuper))
00205         self.assertEqual(False, isinstance(Super(), AbstractChild))
00206 
00207         self.assertEqual(True, isinstance(Child(), Super))
00208         self.assertEqual(False, isinstance(Child(), AbstractSuper))

Here is the call graph for this function:

Definition at line 266 of file test_isinstance.py.

00266 
00267     def test_isinstance_recursion_limit(self):
00268         # make sure that issubclass raises RuntimeError before the C stack is
00269         # blown
00270         self.assertRaises(RuntimeError, blowstack, isinstance, '', str)

Here is the call graph for this function:

Definition at line 231 of file test_isinstance.py.

00231 
00232     def test_subclass_abstract(self):
00233         # abstract classes
00234         self.assertEqual(True, issubclass(AbstractSuper, AbstractSuper))
00235         self.assertEqual(False, issubclass(AbstractSuper, AbstractChild))
00236         self.assertEqual(False, issubclass(AbstractSuper, Child))
00237 
00238         self.assertEqual(True, issubclass(AbstractChild, AbstractChild))
00239         self.assertEqual(True, issubclass(AbstractChild, AbstractSuper))
00240         self.assertEqual(False, issubclass(AbstractChild, Super))
00241         self.assertEqual(False, issubclass(AbstractChild, Child))

Here is the call graph for this function:

Definition at line 221 of file test_isinstance.py.

00221 
00222     def test_subclass_normal(self):
00223         # normal classes
00224         self.assertEqual(True, issubclass(Super, Super))
00225         self.assertEqual(False, issubclass(Super, AbstractSuper))
00226         self.assertEqual(False, issubclass(Super, Child))
00227 
00228         self.assertEqual(True, issubclass(Child, Child))
00229         self.assertEqual(True, issubclass(Child, Super))
00230         self.assertEqual(False, issubclass(Child, AbstractSuper))

Here is the call graph for this function:

Definition at line 261 of file test_isinstance.py.

00261 
00262     def test_subclass_recursion_limit(self):
00263         # make sure that issubclass raises RuntimeError before the C stack is
00264         # blown
00265         self.assertRaises(RuntimeError, blowstack, issubclass, str, str)

Here is the call graph for this function:

Definition at line 242 of file test_isinstance.py.

00242 
00243     def test_subclass_tuple(self):
00244         # test with a tuple as the second argument classes
00245         self.assertEqual(True, issubclass(Child, (Child,)))
00246         self.assertEqual(True, issubclass(Child, (Super,)))
00247         self.assertEqual(False, issubclass(Super, (Child,)))
00248         self.assertEqual(True, issubclass(Super, (Child, Super)))
00249         self.assertEqual(False, issubclass(Child, ()))
00250         self.assertEqual(True, issubclass(Super, (Child, (Super,))))
00251 
00252         self.assertEqual(True, issubclass(NewChild, (NewChild,)))
00253         self.assertEqual(True, issubclass(NewChild, (NewSuper,)))
00254         self.assertEqual(False, issubclass(NewSuper, (NewChild,)))
00255         self.assertEqual(True, issubclass(NewSuper, (NewChild, NewSuper)))
00256         self.assertEqual(False, issubclass(NewChild, ()))
00257         self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,))))
00258 
00259         self.assertEqual(True, issubclass(int, (int, (float, int))))
00260         self.assertEqual(True, issubclass(str, (str, (Child, NewChild, str))))

Here is the call graph for this function:


The documentation for this class was generated from the following file: