From b15260750fbcfe0f08f93b8c69371c9c99ff1060 Mon Sep 17 00:00:00 2001 From: Nicolas Thumann Date: Tue, 14 Mar 2023 09:09:06 +0100 Subject: [PATCH] Add test for unknown encoding using chardet --- codespell_lib/tests/test_basic.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codespell_lib/tests/test_basic.py b/codespell_lib/tests/test_basic.py index 7a36369bf9..d7bd72de9e 100644 --- a/codespell_lib/tests/test_basic.py +++ b/codespell_lib/tests/test_basic.py @@ -384,6 +384,16 @@ def test_encoding( assert "WARNING: Binary file" in stderr +def test_unknown_encoding_chardet( + tmp_path: Path, + capsys: pytest.CaptureFixture[str], +) -> None: + """Test opening a file with unknown encoding using chardet""" + fname = tmp_path / "tmp" + fname.touch() + assert cs.main("--hard-encoding-detection", fname) == 0 + + def test_ignore( tmp_path: Path, capsys: pytest.CaptureFixture[str],