Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fix-utf16-response-test-on-big-endian-systems (#7508)

Fat-Coder-CN870803b7fb1e
diff --git a/tests/test_http_response_text.py b/tests/test_http_response_text.py
index 507fd1864..5ef89fe4a 100644
--- a/tests/test_http_response_text.py
+++ b/tests/test_http_response_text.py
@@ -163,12 +163,13 @@ class TestTextResponse(TestResponse):
def test_utf16(self):
"""Test utf-16 because UnicodeDammit is known to have problems with"""
+ body = b"\xff\xfeh\x00i\x00"
r = self.response_class(
"http://www.example.com",
- body=b"\xff\xfeh\x00i\x00",
+ body=body,
encoding="utf-16",
)
- self._assert_response_values(r, "utf-16", "hi")
+ self._assert_response_values(r, "utf-16", body)
def test_invalid_utf8_encoded_body_with_valid_utf8_BOM(self):
r6 = self.response_class(