()
| 316 | |
| 317 | |
| 318 | def test_read(): |
| 319 | response = httpx.Response( |
| 320 | 200, |
| 321 | content=b"Hello, world!", |
| 322 | ) |
| 323 | |
| 324 | assert response.status_code == 200 |
| 325 | assert response.text == "Hello, world!" |
| 326 | assert response.encoding == "utf-8" |
| 327 | assert response.is_closed |
| 328 | |
| 329 | content = response.read() |
| 330 | |
| 331 | assert content == b"Hello, world!" |
| 332 | assert response.content == b"Hello, world!" |
| 333 | assert response.is_closed |
| 334 | |
| 335 | |
| 336 | def test_empty_read(): |