Back to index

python3.2  3.2.2
Public Member Functions
test.test_typechecks.TypeChecksTest Class Reference

List of all members.

Public Member Functions

def testIsSubclassInternal
def testIsSubclassBuiltin
def testIsInstanceBuiltin
def testIsInstanceActual
def testIsSubclassActual
def testSubclassBehavior

Detailed Description

Definition at line 28 of file test_typechecks.py.


Member Function Documentation

Definition at line 46 of file test_typechecks.py.

00046 
00047     def testIsInstanceActual(self):
00048         self.assertEqual(isinstance(Integer(), Integer), True)
00049         self.assertEqual(isinstance(Integer(), (Integer,)), True)

Here is the call graph for this function:

Definition at line 40 of file test_typechecks.py.

00040 
00041     def testIsInstanceBuiltin(self):
00042         self.assertEqual(isinstance(42, Integer), True)
00043         self.assertEqual(isinstance(42, (Integer,)), True)
00044         self.assertEqual(isinstance(3.14, Integer), False)
00045         self.assertEqual(isinstance(3.14, (Integer,)), False)

Here is the call graph for this function:

Definition at line 50 of file test_typechecks.py.

00050 
00051     def testIsSubclassActual(self):
00052         self.assertEqual(issubclass(Integer, Integer), True)
00053         self.assertEqual(issubclass(Integer, (Integer,)), True)

Here is the call graph for this function:

Definition at line 34 of file test_typechecks.py.

00034 
00035     def testIsSubclassBuiltin(self):
00036         self.assertEqual(issubclass(int, Integer), True)
00037         self.assertEqual(issubclass(int, (Integer,)), True)
00038         self.assertEqual(issubclass(float, Integer), False)
00039         self.assertEqual(issubclass(float, (Integer,)), False)

Here is the call graph for this function:

Definition at line 30 of file test_typechecks.py.

00030 
00031     def testIsSubclassInternal(self):
00032         self.assertEqual(Integer.__subclasscheck__(int), True)
00033         self.assertEqual(Integer.__subclasscheck__(float), False)

Here is the call graph for this function:

Definition at line 54 of file test_typechecks.py.

00054 
00055     def testSubclassBehavior(self):
00056         self.assertEqual(issubclass(SubInt, Integer), True)
00057         self.assertEqual(issubclass(SubInt, (Integer,)), True)
00058         self.assertEqual(issubclass(SubInt, SubInt), True)
00059         self.assertEqual(issubclass(SubInt, (SubInt,)), True)
00060         self.assertEqual(issubclass(Integer, SubInt), False)
00061         self.assertEqual(issubclass(Integer, (SubInt,)), False)
00062         self.assertEqual(issubclass(int, SubInt), False)
00063         self.assertEqual(issubclass(int, (SubInt,)), False)
00064         self.assertEqual(isinstance(SubInt(), Integer), True)
00065         self.assertEqual(isinstance(SubInt(), (Integer,)), True)
00066         self.assertEqual(isinstance(SubInt(), SubInt), True)
00067         self.assertEqual(isinstance(SubInt(), (SubInt,)), True)
00068         self.assertEqual(isinstance(42, SubInt), False)
00069         self.assertEqual(isinstance(42, (SubInt,)), False)
00070 

Here is the call graph for this function:


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