summaryrefslogtreecommitdiff
path: root/tests/test_notify.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-01 22:27:11 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-05 09:34:52 +0000
commit77c0ab02d80c9b6efccf0bb747ce4a6128993828 (patch)
tree0cafcd4d1382dfb77f569d74b3797f2aca9c76cf /tests/test_notify.py
parent56ae1fe4bfe5ebda435d43e310dff7b5d2a8730d (diff)
downloadpsycopg2-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-xtests/test_notify.py5
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__)