Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_compare.ComparisonTest Class Reference

List of all members.

Public Member Functions

def test_comparisons
def test_id_comparisons
def test_ne_defaults_to_not_eq
def test_issue_1393

Static Public Attributes

list set1 = [2, 2.0, 2, 2+0j, Cmp(2.0)]
list set2 = [[1], (3,), None, Empty()]
 candidates = set1+set2

Detailed Description

Definition at line 25 of file test_compare.py.


Member Function Documentation

Definition at line 30 of file test_compare.py.

00030 
00031     def test_comparisons(self):
00032         for a in self.candidates:
00033             for b in self.candidates:
00034                 if ((a in self.set1) and (b in self.set1)) or a is b:
00035                     self.assertEqual(a, b)
00036                 else:
00037                     self.assertNotEqual(a, b)

Here is the call graph for this function:

Definition at line 38 of file test_compare.py.

00038 
00039     def test_id_comparisons(self):
00040         # Ensure default comparison compares id() of args
00041         L = []
00042         for i in range(10):
00043             L.insert(len(L)//2, Empty())
00044         for a in L:
00045             for b in L:
00046                 self.assertEqual(a == b, id(a) == id(b),
00047                                  'a=%r, b=%r' % (a, b))

Here is the call graph for this function:

Definition at line 54 of file test_compare.py.

00054 
00055     def test_issue_1393(self):
00056         x = lambda: None
00057         self.assertEqual(x, Anything())
00058         self.assertEqual(Anything(), x)
00059         y = object()
00060         self.assertEqual(y, Anything())
00061         self.assertEqual(Anything(), y)
00062 

Here is the call graph for this function:

Definition at line 48 of file test_compare.py.

00048 
00049     def test_ne_defaults_to_not_eq(self):
00050         a = Cmp(1)
00051         b = Cmp(1)
00052         self.assertTrue(a == b)
00053         self.assertFalse(a != b)

Here is the call graph for this function:


Member Data Documentation

Definition at line 28 of file test_compare.py.

list test.test_compare.ComparisonTest.set1 = [2, 2.0, 2, 2+0j, Cmp(2.0)] [static]

Definition at line 26 of file test_compare.py.

list test.test_compare.ComparisonTest.set2 = [[1], (3,), None, Empty()] [static]

Definition at line 27 of file test_compare.py.


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