Test failures w/ charset-normalizer 2.0.7+ #1972
Unanswered
mgorny
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
On systems w/ charset-normalizer 2.0.7 or newer, the "Österreich" tests fail:
============================================================== FAILURES =============================================================== _________________________________________________ test_text_decoder[data3-iso-8859-1] _________________________________________________ data = (b'Accented: \xd6sterreich abcdefghijklmnopqrstuvwxyz', b''), encoding = 'iso-8859-1' @pytest.mark.parametrize( ["data", "encoding"], [ ((b"Hello,", b" world!"), "ascii"), ((b"\xe3\x83", b"\x88\xe3\x83\xa9", b"\xe3", b"\x83\x99\xe3\x83\xab"), "utf-8"), ((b"Euro character: \x88! abcdefghijklmnopqrstuvwxyz", b""), "cp1252"), ((b"Accented: \xd6sterreich abcdefghijklmnopqrstuvwxyz", b""), "iso-8859-1"), ], ) @pytest.mark.asyncio async def test_text_decoder(data, encoding): async def iterator(): nonlocal data for chunk in data: yield chunk # Accessing `.text` on a read response. response = httpx.Response( 200, content=iterator(), ) await response.aread() > assert response.text == (b"".join(data)).decode(encoding) E AssertionError: assert 'Accented: ųs...nopqrstuvwxyz' == 'Accented: Ös...nopqrstuvwxyz' E - Accented: Österreich abcdefghijklmnopqrstuvwxyz E ? ^ E + Accented: ųsterreich abcdefghijklmnopqrstuvwxyz E ? ^ tests/test_decoders.py:199: AssertionError __________________________________________ test_response_no_charset_with_iso_8859_1_content ___________________________________________ def test_response_no_charset_with_iso_8859_1_content(): """ A response with ISO 8859-1 encoded content should decode correctly, even with no charset specified. """ content = "Accented: Österreich abcdefghijklmnopqrstuzwxyz".encode("iso-8859-1") headers = {"Content-Type": "text/plain"} response = httpx.Response( 200, content=content, headers=headers, ) > assert response.text == "Accented: Österreich abcdefghijklmnopqrstuzwxyz" E AssertionError: assert 'Accented: ųs...nopqrstuzwxyz' == 'Accented: Ös...nopqrstuzwxyz' E - Accented: Österreich abcdefghijklmnopqrstuzwxyz E ? ^ E + Accented: ųsterreich abcdefghijklmnopqrstuzwxyz E ? ^ tests/models/test_responses.py:240: AssertionError2.0.7 was released already two months ago; could you please either update the tests to work against this version, or report a bug against charset-normalizer if this is a bug?
Beta Was this translation helpful? Give feedback.
All reactions