def test_compare_tuple(self): from psycopg2.extensions import Notify self.assertEqual((10, "foo"), Notify(10, "foo")) self.assertEqual((10, "foo"), Notify(10, "foo", "bar")) self.assertNotEqual((10, "foo"), Notify(20, "foo")) self.assertNotEqual((10, "foo"), Notify(10, "bar"))
def make_event(self, payload=None): if payload is None: payload = self.make_payload() from psycopg2.extensions import Notify notif = Notify(pid=555, channel='post_publication', payload=payload) from cnxpublishing.events import PostPublicationEvent event = PostPublicationEvent(notif) return event
def _make_one(self, payload, channel=None, pid=None): """Make a `psycopg2.extensions.Notify` object""" if channel is None: channel = 'testing' if pid is None: pid = 5555 from psycopg2.extensions import Notify notif = Notify(pid=pid, channel=channel, payload=payload) return notif
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_compare_tuple(self): from psycopg2.extensions import Notify self.assertEqual((10, 'foo'), Notify(10, 'foo')) self.assertEqual((10, 'foo'), Notify(10, 'foo', 'bar')) 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_hash(self): self.assertEqual(hash((10, 'foo')), hash(Notify(10, 'foo'))) self.assertNotEqual(hash(Notify(10, 'foo', 'bar')), hash(Notify(10, 'foo')))
def test_compare_tuple(self): self.assertEqual((10, 'foo'), Notify(10, 'foo')) self.assertEqual((10, 'foo'), Notify(10, 'foo', 'bar')) self.assertNotEqual((10, 'foo'), Notify(20, 'foo')) self.assertNotEqual((10, 'foo'), Notify(10, 'bar'))