]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Adapt test_response_decode_text_using_autodetect for chardet 6.0 (#3773) master
authorBen Beasley <code@musicinmybrain.net>
Mon, 23 Feb 2026 10:40:42 +0000 (10:40 +0000)
committerGitHub <noreply@github.com>
Mon, 23 Feb 2026 10:40:42 +0000 (10:40 +0000)
tests/models/test_responses.py

index 06c28e1e30b3bb77325327e82b368687f6bbe65c..d2972da5bd2e7803cb7ebb789d120acc5f250f9a 100644 (file)
@@ -1011,7 +1011,10 @@ def test_response_decode_text_using_autodetect():
 
     assert response.status_code == 200
     assert response.reason_phrase == "OK"
-    assert response.encoding == "ISO-8859-1"
+    # The encoded byte string is consistent with either ISO-8859-1 or
+    # WINDOWS-1252. Versions <6.0 of chardet claim the former, while chardet
+    # 6.0 detects the latter.
+    assert response.encoding in ("ISO-8859-1", "WINDOWS-1252")
     assert response.text == text