From de72f98fbe01d571ac6eea4eca8ecc2dcefbfdc0 Mon Sep 17 00:00:00 2001 From: Travis Johnson Date: Mon, 8 Dec 2014 18:17:32 -0500 Subject: [PATCH] test for workers equality --- tests/test_worker.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_worker.py b/tests/test_worker.py index c6d85ff..59f0b26 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -318,3 +318,12 @@ class TestWorker(RQTestCase): 'Expected at least some work done.') self.assertEquals(job.result, 'Hi there, Adam!') self.assertEquals(job.description, '你好 世界!') + + def test_worker_hash_(self): + """Workers are hashed by their .name attribute""" + q = Queue('foo') + w1 = Worker([q], name="worker1") + w2 = Worker([q], name="worker2") + w3 = Worker([q], name="worker1") + worker_set = {w1, w2, w3} + self.assertEquals(len(worker_set), 2)