diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-11-01 22:27:11 +0000 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-11-05 09:34:52 +0000 |
| commit | 77c0ab02d80c9b6efccf0bb747ce4a6128993828 (patch) | |
| tree | 0cafcd4d1382dfb77f569d74b3797f2aca9c76cf /tests/test_notify.py | |
| parent | 56ae1fe4bfe5ebda435d43e310dff7b5d2a8730d (diff) | |
| download | psycopg2-77c0ab02d80c9b6efccf0bb747ce4a6128993828.tar.gz | |
The Notify type is hashable.
If there is no payload, hash the same way the equivalent 2-tuple does.
Otherwise hash on the payload too.
Diffstat (limited to 'tests/test_notify.py')
| -rwxr-xr-x | tests/test_notify.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_notify.py b/tests/test_notify.py index 7dc45d9..83c1061 100755 --- a/tests/test_notify.py +++ b/tests/test_notify.py @@ -170,6 +170,11 @@ conn.close() self.assertNotEqual((10, 'foo'), Notify(20, 'foo')) self.assertNotEqual((10, 'foo'), Notify(10, 'bar')) + def test_hash(self): + from psycopg2.extensions import Notify + self.assertEqual(hash((10, 'foo')), hash(Notify(10, 'foo'))) + self.assertNotEqual(hash(Notify(10, 'foo', 'bar')), + hash(Notify(10, 'foo'))) def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__) |
