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

Method test_read

impit-python/test/no_client_test.py:325–338  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

323
324class TestStreamRequest:
325 def test_read(self) -> None:
326 with impit.stream('GET', get_httpbin_url('/')) as response:
327 assert response.status_code == 200
328 assert response.is_closed is False
329 assert response.is_stream_consumed is False
330
331 content = response.read()
332
333 assert isinstance(content, bytes)
334 assert content.decode('utf-8') == response.text
335 assert response.content == content
336
337 assert response.is_closed is True
338 assert response.is_stream_consumed is True # type: ignore[unreachable] # Mypy can't detect a change of state
339
340 def test_iter_bytes(self) -> None:
341 with impit.stream('GET', get_httpbin_url('/')) as response:

Callers

nothing calls this directly

Calls 3

get_httpbin_urlFunction · 0.85
readMethod · 0.80
streamMethod · 0.45

Tested by

no test coverage detected