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

Method test_read

impit-python/test/basic_client_test.py:523–538  ·  view source on GitHub ↗
(self, browser: Browser)

Source from the content-addressed store, hash-verified

521)
522class TestStreamRequest:
523 def test_read(self, browser: Browser) -> None:
524 impit = Client(browser=browser)
525
526 with impit.stream('GET', get_httpbin_url('/')) as response:
527 assert response.status_code == 200
528 assert response.is_closed is False
529 assert response.is_stream_consumed is False
530
531 content = response.read()
532
533 assert isinstance(content, bytes)
534 assert content.decode('utf-8') == response.text
535 assert response.content == content
536
537 assert response.is_closed is True
538 assert response.is_stream_consumed is True # type: ignore[unreachable] # Mypy can't detect a change of state
539
540 def test_iter_bytes(self, browser: Browser) -> None:
541 impit = Client(browser=browser)

Callers

nothing calls this directly

Calls 4

streamMethod · 0.95
ClientClass · 0.90
get_httpbin_urlFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected