Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
unittest.test.support.TestHashing Class Reference
Inheritance diagram for unittest.test.support.TestHashing:
Inheritance graph
[legend]
Collaboration diagram for unittest.test.support.TestHashing:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_hash

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Used as a mixin for TestCase

Definition at line 19 of file support.py.


Member Function Documentation

Definition at line 23 of file support.py.

00023 
00024     def test_hash(self):
00025         for obj_1, obj_2 in self.eq_pairs:
00026             try:
00027                 if not hash(obj_1) == hash(obj_2):
00028                     self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
00029             except KeyboardInterrupt:
00030                 raise
00031             except Exception as e:
00032                 self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))
00033 
00034         for obj_1, obj_2 in self.ne_pairs:
00035             try:
00036                 if hash(obj_1) == hash(obj_2):
00037                     self.fail("%s and %s hash equal, but shouldn't" %
00038                               (obj_1, obj_2))
00039             except KeyboardInterrupt:
00040                 raise
00041             except Exception as e:
00042                 self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e))
00043 

Here is the call graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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