def test_create_instance_method_job(self): """Creation of jobs for instance methods.""" n = Number(2) job = Job.create(func=n.div, args=(4,)) # Job data is set self.assertEquals(job.func(4), n.div(4)) self.assertEquals(job.instance, n) self.assertEquals(job.args, (4,))
def test_create_instance_method_job(self): """Creation of jobs for instance methods.""" n = Number(2) job = Job.create(func=n.div, args=(4, )) # Job data is set self.assertEquals(job.func, n.div) self.assertEquals(job.instance, n) self.assertEquals(job.args, (4, ))
def test_dequeue_instance_method(self): """Dequeueing instance method jobs from queues.""" q = Queue() n = Number(2) 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, ))