Back to index

python3.2  3.2.2
Public Member Functions
test.test_richcmp.NumberTest Class Reference

List of all members.

Public Member Functions

def test_basic
def checkvalue
def test_values

Detailed Description

Definition at line 138 of file test_richcmp.py.


Member Function Documentation

def test.test_richcmp.NumberTest.checkvalue (   self,
  opname,
  a,
  b,
  expres 
)

Definition at line 158 of file test_richcmp.py.

00158 
00159     def checkvalue(self, opname, a, b, expres):
00160         for typea in (int, Number):
00161             for typeb in (int, Number):
00162                 ta = typea(a)
00163                 tb = typeb(b)
00164                 for op in opmap[opname]:
00165                     realres = op(ta, tb)
00166                     realres = getattr(realres, "x", realres)
00167                     self.assertTrue(realres is expres)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 140 of file test_richcmp.py.

00140 
00141     def test_basic(self):
00142         # Check that comparisons involving Number objects
00143         # give the same results give as comparing the
00144         # corresponding ints
00145         for a in range(3):
00146             for b in range(3):
00147                 for typea in (int, Number):
00148                     for typeb in (int, Number):
00149                         if typea==typeb==int:
00150                             continue # the combination int, int is useless
00151                         ta = typea(a)
00152                         tb = typeb(b)
00153                         for ops in opmap.values():
00154                             for op in ops:
00155                                 realoutcome = op(a, b)
00156                                 testoutcome = op(ta, tb)
00157                                 self.assertEqual(realoutcome, testoutcome)

Here is the call graph for this function:

Definition at line 168 of file test_richcmp.py.

00168 
00169     def test_values(self):
00170         # check all operators and all comparison results
00171         self.checkvalue("lt", 0, 0, False)
00172         self.checkvalue("le", 0, 0, True )
00173         self.checkvalue("eq", 0, 0, True )
00174         self.checkvalue("ne", 0, 0, False)
00175         self.checkvalue("gt", 0, 0, False)
00176         self.checkvalue("ge", 0, 0, True )
00177 
00178         self.checkvalue("lt", 0, 1, True )
00179         self.checkvalue("le", 0, 1, True )
00180         self.checkvalue("eq", 0, 1, False)
00181         self.checkvalue("ne", 0, 1, True )
00182         self.checkvalue("gt", 0, 1, False)
00183         self.checkvalue("ge", 0, 1, False)
00184 
00185         self.checkvalue("lt", 1, 0, False)
00186         self.checkvalue("le", 1, 0, False)
00187         self.checkvalue("eq", 1, 0, False)
00188         self.checkvalue("ne", 1, 0, True )
00189         self.checkvalue("gt", 1, 0, True )
00190         self.checkvalue("ge", 1, 0, True )

Here is the call graph for this function:


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