Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

test(api): add a test for `detect_file_encodings` (#29778)

wangxiaolei4fce99379ec5
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 00000000000..edf8735e573
--- /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")]