========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= test session starts ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.12', 'Platform': 'Linux-6.8.0-1025-gke-x86_64-with-glibc2.35', 'Packages': {'pytest': '9.0.3', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.13.0', 'metadata': '3.1.1', 'json-report': '1.5.0', 'cov': '7.1.0'}}
rootdir: /workspace/chardet
configfile: setup.cfg
plugins: anyio-4.13.0, metadata-3.1.1, json-report-1.5.0, cov-7.1.0
collected 381 items

test.py::test_encoding_detection[tests/iso-8859-7-greek/disabled.gr.xml-iso-8859-7] XPASS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [  0%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.cmm.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  0%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/_ude_1.txt-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [  0%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.spo.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  1%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/hotstation.gr.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [  1%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.fin.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  1%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.wld.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  1%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/_ude_3.txt-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [  2%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.mrt.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  2%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/_chromium_ISO-8859-7_with_no_encoding_specified.html-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [  2%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/_ude_2.txt-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [  2%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.bus.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [  3%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/_ude_greek.txt-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [  3%]
test.py::test_encoding_detection[tests/iso-8859-7-greek/naftemporiki.gr.mrk.xml-iso-8859-7] PASSED                                                                                                                                                                                                                                                                                                                                                                              <response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE>                                                                                                                                                                                                                                                                                                                                                                                                                                                [ 98%]
test.py::test_encoding_detection[tests/EUC-KR/ittrend.egloos.com.xml-euc-kr] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [ 99%]
test.py::test_encoding_detection[tests/EUC-KR/yunho.egloos.com.xml-euc-kr] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [ 99%]
test.py::test_encoding_detection[tests/EUC-KR/willis.egloos.com.xml-euc-kr] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               [ 99%]
test.py::test_encoding_detection[tests/EUC-KR/xenix.egloos.com.xml-euc-kr] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [100%]

=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== FAILURES ===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_encoding_detection[tests/EUC-JP/_mozilla_bug431054_text.html-euc-jp] _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

file_name = 'tests/EUC-JP/_mozilla_bug431054_text.html', encoding = 'euc-jp'

    @pytest.mark.parametrize("file_name, encoding", gen_test_params())
    def test_encoding_detection(file_name, encoding):
        with open(file_name, "rb") as f:
            input_bytes = f.read()
            result = chardet.detect(input_bytes)
            try:
                expected_unicode = input_bytes.decode(encoding)
            except LookupError:
                expected_unicode = ""
            try:
                detected_unicode = input_bytes.decode(result["encoding"])
            except (LookupError, UnicodeDecodeError, TypeError):
                detected_unicode = ""
        if result:
            encoding_match = (result["encoding"] or "").lower() == encoding
        else:
            encoding_match = False
        # Only care about mismatches that would actually result in different
        # behavior when decoding
        if not encoding_match and expected_unicode != detected_unicode:
            wrapped_expected = "\n".join(textwrap.wrap(expected_unicode, 100)) + "\n"
            wrapped_detected = "\n".join(textwrap.wrap(detected_unicode, 100)) + "\n"
            diff = "".join(
                list(
                    ndiff(
                        wrapped_expected.splitlines(True), wrapped_detected.splitlines(True)
                    )
                )[:20]
            )
            all_encodings = chardet.detect_all(input_bytes, ignore_threshold=True)
        else:
            diff = ""
            encoding_match = True
            all_encodings = [result]
>       assert encoding_match, (
            f"Expected {encoding}, but got {result} for {file_name}.  First 20 "
            f"lines of character differences: \n{diff}\n"
            f"All encodings: {pformat(all_encodings)}"
        )
E       AssertionError: Expected euc-jp, but got {'encoding': 'Johab', 'confidence': 0.65, 'language': 'Korean'} for tests/EUC-JP/_mozilla_bug431054_text.html.  First 20 lines of character differences:
E         - <html> <body> ログイン </body> </html>
E         ?               ^^^^
E         + <html> <body> 봸봃볷봽 </body> </html>
E         ?               ^^^^
E
E         All encodings: [{'confidence': 0.65, 'encoding': 'Johab', 'language': 'Korean'}]
E       assert False

test.py:110: AssertionError
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_encoding_detection[tests/EUC-TW/_ude_euc-tw1.txt-euc-tw] _____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

file_name = 'tests/EUC-TW/_ude_euc-tw1.txt', encoding = 'euc-tw'

    @pytest.mark.parametrize("file_name, encoding", gen_test_params())
    def test_encoding_detection(file_name, encoding):
        with open(file_name, "rb") as f:
            input_bytes = f.read()
            result = chardet.detect(input_bytes)
            try:
                expected_unicode = input_bytes.decode(encoding)
            except LookupError:
                expected_unicode = ""
            try:
                detected_unicode = input_bytes.decode(result["encoding"])
            except (LookupError, UnicodeDecodeError, TypeError):
                detected_unicode = ""
        if result:
            encoding_match = (result["encoding"] or "").lower() == encoding
        else:
            encoding_match = False
        # Only care about mismatches that would actually result in different
        # behavior when decoding
        if not encoding_match and expected_unicode != detected_unicode:
            wrapped_expected = "\n".join(textwrap.wrap(expected_unicode, 100)) + "\n"
            wrapped_detected = "\n".join(textwrap.wrap(detected_unicode, 100)) + "\n"
            diff = "".join(
                list(
                    ndiff(
                        wrapped_expected.splitlines(True), wrapped_detected.splitlines(True)
                    )
                )[:20]
            )
            all_encodings = chardet.detect_all(input_bytes, ignore_threshold=True)
        else:
            diff = ""
            encoding_match = True
            all_encodings = [result]
>       assert encoding_match, (
            f"Expected {encoding}, but got {result} for {file_name}.  First 20 "
            f"lines of character differences: \n{diff}\n"
            f"All encodings: {pformat(all_encodings)}"
        )
E       AssertionError: Expected euc-tw, but got {'encoding': 'GB18030', 'confidence': 0.65, 'language': 'Chinese'} for tests/EUC-TW/_ude_euc-tw1.txt.  First 20 lines of character differences:
E         -
E         + 昴僮乃台【Wikipedia】席、杲纣页鲳¨怩挪亩稀。凭掷似。芨末实、阵人绎埏·填散席、昴僮掼僮馅淠木·
E         + 台晡喷筒搜取牟抹盘沤摹、暖淖泥取抹盘牟摩、拳侵派耄似抹人撵牟、琴绶膜人遘气¨抹牟乃毯赛默醛、尢恿牌毯签绱抹人遘·诰牌磨挪亩却实橇岘仍醛¨却泗煞逆、摭杲纣。蝰散、乃台勇埏·
E         + 昴僮摹猡、砒埏契驺昴僮·∥甬耐忡猞∠潘～≈昴、木∽、∥氅牌∠潘～≈僮、艋填木∽、抬末琴逆、探泗戊逆填木·昴鳋杲昃、盆绁拯欺、签昴僮木·
E         + 乃台诘捅、茄绗岳圊¨邱浠晏。隰欺。檫怏。糯鹦。耄蜱。牌栈岖·抬毯气情偏葺镥院王鲞逆鹇¨赇芨拟铫铩、源诘曦昙、蒲瘫睦抬针抬氢抬末、嘤鞋台驮绁骼枰、栖森舞·
E         + 幕昴僮逆岈、驮疸席、潘芋泼溶岂牌篁萋偏潭、咽偏溶岂燧惝挪亩戎·  牌似昴僮填王胚颧取膜氖、苏聂诘牌抹呐摹人默牟摩·     commons:毯欲         豇獐研、苔蜱王昴僮橇岁～昴僮乃台·
E
E         All encodings: [{'confidence': 0.65, 'encoding': 'GB18030', 'language': 'Chinese'}]
E       assert False

test.py:110: AssertionError
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= short test summary info ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
FAILED test.py::test_encoding_detection[tests/EUC-JP/_mozilla_bug431054_text.html-euc-jp] - AssertionError: Expected euc-jp, but got {'encoding': 'Johab', 'confidence': 0.65, 'language': 'Korean'} for tests/EUC-JP/_mozilla_bug431054_text.html.  First 20 lines of character differences:
FAILED test.py::test_encoding_detection[tests/EUC-TW/_ude_euc-tw1.txt-euc-tw] - AssertionError: Expected euc-tw, but got {'encoding': 'GB18030', 'confidence': 0.65, 'language': 'Chinese'} for tests/EUC-TW/_ude_euc-tw1.txt.  First 20 lines of character differences:
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 2 failed, 373 passed, 6 xpassed in 0.79s ===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[The command completed with exit code 1.]
[Current working directory: /workspace/chardet]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 1]