MCPcopy Create free account
hub / github.com/apify/impit / test_read

Method test_read

impit-python/test/async_client_test.py:550–565  ·  view source on GitHub ↗
(self, browser: Browser)

Source from the content-addressed store, hash-verified

548)
549class TestStreamRequest:
550 async def test_read(self, browser: Browser) -> None:
551 impit = AsyncClient(browser=browser)
552
553 async with impit.stream('GET', get_httpbin_url('/')) as response:
554 assert response.status_code == 200
555 assert response.is_closed is False
556 assert response.is_stream_consumed is False
557
558 content = await response.aread()
559
560 assert isinstance(content, bytes)
561 assert content.decode('utf-8') == response.text
562 assert response.content == content
563
564 assert response.is_closed is True
565 assert response.is_stream_consumed is True # type: ignore[unreachable] # Mypy can't detect a change of state
566
567 async def test_iter_bytes(self, browser: Browser) -> None:
568 impit = AsyncClient(browser=browser)

Callers

nothing calls this directly

Calls 4

streamMethod · 0.95
AsyncClientClass · 0.90
get_httpbin_urlFunction · 0.85
areadMethod · 0.80

Tested by

no test coverage detected