Ejemplo n.º 1
0
    async def test_should_raise_would_block_error_when_buffer_is_full_and_put_nowait_is_used(
            self):
        queue = Queue()
        queue.put_nowait(1)

        with pytest.raises(anyio.WouldBlock):
            queue.put_nowait(2)
Ejemplo n.º 2
0
    async def test_should_reset_event_when_event_is_set_and_put_nowait_is_called(
            self):
        queue = Queue()
        queue._finished.set()
        queue.put_nowait(2)

        assert not queue._finished.is_set()
Ejemplo n.º 3
0
    async def test_should_work_when_adding_item_with_put_nowait_method(self):
        queue = Queue(size=3)
        queue.put_nowait(2)

        assert 1 == queue.length
        assert 1 == queue._tasks_in_progress