Skip to content

Commit 37da471

Browse files
committed
test(fetch): actually encode euc-kr in test_korean_euc_kr
The test was encoding the Korean text as UTF-8, so it did not exercise the charset-normalizer detection path. Encode with euc-kr and extend the sample text so statistical detection has enough bytes to work with. Addresses review feedback on #3880. Made-with: Cursor
1 parent 07c7846 commit 37da471

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/fetch/tests/test_server.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ def test_arabic_windows_1256(self):
372372
assert text in get_response_text(_build_response(body))
373373

374374
def test_korean_euc_kr(self):
375-
text = "서울특별시는 대한민국의 수도이자 최대 도시이다"
376-
body = text.encode("utf-8")
377-
resp = httpx.Response(200, headers={"content-type": "text/html"}, content=body)
378-
assert text in get_response_text(resp)
375+
text = "서울특별시는 대한민국의 수도이자 최대 도시이며 정치 경제 문화의 중심지로 오랜 역사와 전통을 자랑하는 동아시아의 주요 도시입니다."
376+
body = (
377+
b"<html><body><p>" + text.encode("euc-kr") + b"</p></body></html>"
378+
)
379+
assert text in get_response_text(_build_response(body))

0 commit comments

Comments
 (0)