def test_basic(values_with_key: Tuple[List[Value], Optional[SortingKey]], reverse: bool) -> None: values, key = values_with_key result = PriorityQueue(*values, key=key, reverse=reverse) assert len(result) == len(values) assert all(value in result.values() for value in values) assert result.key is key assert result.reverse is reverse
def test_step(priority_queue: PriorityQueue) -> None: result = priority_queue.peek() assert result in priority_queue.values() assert all(not item < priority_queue._item_factory(result) for item in priority_queue._items)
def to_priority_queues_with_their_values(queue: PriorityQueue ) -> Strategy[Tuple[PriorityQueue, Value]]: return strategies.tuples(strategies.just(queue), strategies.sampled_from(queue.values()))