def test_bzpoptimed_on_set_update(self) -> None: new = (b'x', time() + 0.5) def _add() -> None: sleep(0.25) self.r.r.zadd('queue', {new[0]: new[1]}) thread = Thread(target=_add) thread.start() member = bzpoptimed(self.r.r, 'queue') thread.join() self.assertEqual(member, new)
def test_bzpoptimed_empty_set(self) -> None: member = bzpoptimed(self.r.r, 'queue', timeout=0.25) self.assertIsNone(member)
def test_bzpoptimed_future_member(self) -> None: members = self.make_queue(time() + 0.25) member = bzpoptimed(self.r.r, 'queue') self.assertEqual(member, members[0])