(self)
| 1233 | next(reader) |
| 1234 | |
| 1235 | def test_io_textiowrapper(self) -> None: |
| 1236 | fp = BytesIO(b"\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f") |
| 1237 | resp = HTTPResponse(fp, preload_content=False) |
| 1238 | br = TextIOWrapper(resp, encoding="utf8") # type: ignore[type-var] |
| 1239 | |
| 1240 | assert br.read() == "äöüß" |
| 1241 | |
| 1242 | br.close() |
| 1243 | assert resp.closed |
| 1244 | |
| 1245 | # HTTPResponse.read() by default closes the response |
| 1246 | # https://github.com/urllib3/urllib3/issues/1305 |
| 1247 | fp = BytesIO( |
| 1248 | b"\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f\n\xce\xb1\xce\xb2\xce\xb3\xce\xb4" |
| 1249 | ) |
| 1250 | resp = HTTPResponse(fp, preload_content=False) |
| 1251 | with pytest.raises(ValueError, match="I/O operation on closed file.?"): |
| 1252 | list(TextIOWrapper(resp)) # type: ignore[type-var] |
| 1253 | |
| 1254 | def test_io_not_autoclose_textiowrapper(self) -> None: |
| 1255 | fp = BytesIO( |
nothing calls this directly
no test coverage detected