def test_queue_get(): q = Q(maxsize=3) q.put(1) q.put(2) assert list(q.get()) == [1, 2] with pytest.raises(Empty): q.get(block=False)
def test_queue_full(): q = Q(maxsize=3) q.put(1) q.put(2) q.put(3) q.put(4) assert (list(q.queue) == [1, 2, 4] or list(q.queue) == [1, 4, 3] or list(q.queue) == [4, 2, 3])
def test_queue_full(): q = Q(maxsize=3) q.put([1]) q.put(2) q.put([3]) q.put([4, 4]) assert list(q.queue) == [[1], 2, [4, 4]] or list(q.queue) == [[1], [4, 4], [3]] or list(q.queue) == [[4, 4], 2, [3]] assert q.dropped == 1 assert q.accepted == 4 assert q.accepted_lengths == 5 dropped, accepted, accepted_lengths = q.reset_stats() assert dropped == 1 assert accepted == 4 assert accepted_lengths == 5