(self)
| 1761 | assert bytes_to_str(self.b.get_key_for_chord(tid)) == f"chord-unlock-{tid}" |
| 1762 | |
| 1763 | def test_get_many(self): |
| 1764 | for is_dict in True, False: |
| 1765 | self.b.mget_returns_dict = is_dict |
| 1766 | ids = {uuid(): i for i in range(10)} |
| 1767 | for id, i in ids.items(): |
| 1768 | self.b.mark_as_done(id, i) |
| 1769 | it = self.b.get_many(list(ids), interval=0.01) |
| 1770 | for i, (got_id, got_state) in enumerate(it): |
| 1771 | assert got_state['result'] == ids[got_id] |
| 1772 | assert i == 9 |
| 1773 | assert list(self.b.get_many(list(ids), interval=0.01)) |
| 1774 | |
| 1775 | self.b._cache.clear() |
| 1776 | callback = Mock(name='callback') |
| 1777 | it = self.b.get_many( |
| 1778 | list(ids), |
| 1779 | on_message=callback, |
| 1780 | interval=0.05 |
| 1781 | ) |
| 1782 | for i, (got_id, got_state) in enumerate(it): |
| 1783 | assert got_state['result'] == ids[got_id] |
| 1784 | assert i == 9 |
| 1785 | assert list( |
| 1786 | self.b.get_many(list(ids), interval=0.01) |
| 1787 | ) |
| 1788 | callback.assert_has_calls([ |
| 1789 | call(ANY) for id in ids |
| 1790 | ]) |
| 1791 | |
| 1792 | def test_get_many_times_out(self): |
| 1793 | tasks = [uuid() for _ in range(4)] |
nothing calls this directly
no test coverage detected