Ejemplo n.º 1
0
    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"))
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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')))
Ejemplo n.º 5
0
 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'))
Ejemplo n.º 6
0
    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")))
Ejemplo n.º 7
0
 def test_hash(self):
     self.assertEqual(hash((10, 'foo')), hash(Notify(10, 'foo')))
     self.assertNotEqual(hash(Notify(10, 'foo', 'bar')),
                         hash(Notify(10, 'foo')))
Ejemplo n.º 8
0
 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'))