From 4fce99379ec56e0bbd71643c93b3cadc83901aaf Mon Sep 17 00:00:00 2001 From: wangxiaolei Date: Wed, 17 Dec 2025 14:33:30 +0800 Subject: [PATCH] test(api): add a test for `detect_file_encodings` (#29778) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../unit_tests/core/rag/extractor/test_helpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 api/tests/unit_tests/core/rag/extractor/test_helpers.py diff --git a/api/tests/unit_tests/core/rag/extractor/test_helpers.py b/api/tests/unit_tests/core/rag/extractor/test_helpers.py new file mode 100644 index 0000000000..edf8735e57 --- /dev/null +++ b/api/tests/unit_tests/core/rag/extractor/test_helpers.py @@ -0,0 +1,10 @@ +import tempfile + +from core.rag.extractor.helpers import FileEncoding, detect_file_encodings + + +def test_detect_file_encodings() -> None: + with tempfile.NamedTemporaryFile(mode="w+t", suffix=".txt") as temp: + temp.write("Shared data") + temp_path = temp.name + assert detect_file_encodings(temp_path) == [FileEncoding(encoding="utf_8", confidence=0.0, language="Unknown")]