Back to index

python3.2  3.2.2
Public Member Functions
test.test_hash.HashEqualityTestCase Class Reference

List of all members.

Public Member Functions

def same_hash
def test_numeric_literals
def test_coerced_integers
def test_coerced_floats

Detailed Description

Definition at line 11 of file test_hash.py.


Member Function Documentation

def test.test_hash.HashEqualityTestCase.same_hash (   self,
  objlist 
)

Definition at line 13 of file test_hash.py.

00013 
00014     def same_hash(self, *objlist):
00015         # Hash each object given and fail if
00016         # the hash values are not all the same.
00017         hashed = list(map(hash, objlist))
00018         for h in hashed[1:]:
00019             if h != hashed[0]:
00020                 self.fail("hashed values differ: %r" % (objlist,))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 38 of file test_hash.py.

00038 
00039     def test_coerced_floats(self):
00040         self.same_hash(int(1.23e300), float(1.23e300))
00041         self.same_hash(float(0.5), complex(0.5, 0.0))
00042 

Here is the call graph for this function:

Definition at line 27 of file test_hash.py.

00027 
00028     def test_coerced_integers(self):
00029         self.same_hash(int(1), int(1), float(1), complex(1),
00030                        int('1'), float('1.0'))
00031         self.same_hash(int(-2**31), float(-2**31))
00032         self.same_hash(int(1-2**31), float(1-2**31))
00033         self.same_hash(int(2**31-1), float(2**31-1))
00034         # for 64-bit platforms
00035         self.same_hash(int(2**31), float(2**31))
00036         self.same_hash(int(-2**63), float(-2**63))
00037         self.same_hash(int(2**63), float(2**63))

Here is the call graph for this function:

Definition at line 21 of file test_hash.py.

00021 
00022     def test_numeric_literals(self):
00023         self.same_hash(1, 1, 1.0, 1.0+0.0j)
00024         self.same_hash(0, 0.0, 0.0+0.0j)
00025         self.same_hash(-1, -1.0, -1.0+0.0j)
00026         self.same_hash(-2, -2.0, -2.0+0.0j)

Here is the call graph for this function:


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