From 7ea02d4029ecab6afb696f400dd303d6ea80b05b Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 19 Apr 2013 21:21:53 +0200 Subject: [PATCH] Add explicit classmethod test. --- tests/test_queue.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_queue.py b/tests/test_queue.py index e5bd7fd..0385e0a 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -165,8 +165,20 @@ class TestQueue(RQTestCase): q.enqueue(n.div, 4) job = q.dequeue() + # The instance has been pickled and unpickled, so it is now a separate # object. Test for equality using each object's __dict__ instead. + self.assertEquals(job.instance.__dict__, n.__dict__) + self.assertEquals(job.func.__name__, 'div') + self.assertEquals(job.args, (4,)) + + def test_dequeue_class_method(self): + """Dequeueing class method jobs from queues.""" + q = Queue() + q.enqueue(Number.divide, 3, 4) + + job = q.dequeue() + self.assertEquals(job.instance.__dict__, Number.__dict__) self.assertEquals(job.func.__name__, 'divide') self.assertEquals(job.args, (3, 4))