mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-19 02:13:47 +00:00
feat: prune some deps
This commit is contained in:
1 parent
c5b372df1e
commit
a166796f6c
26 files changed
+1937
-1343
No files matched your search
+10
-10
@@ -73,30 +73,30 @@ class TestDocumentBase:
|
||||
with pytest.raises(ValueError, match="text field not set"):
|
||||
Document(text=None)
|
||||
|
||||
def test_document_to_langchain_format(self):
|
||||
"""Cover line 27: Document.to_langchain_format converts correctly."""
|
||||
def test_document_to_vector_format(self):
|
||||
"""Cover line 27: Document.to_vector_format converts correctly."""
|
||||
from application.parser.schema.base import Document
|
||||
|
||||
doc = Document(text="hello world", extra_info={"source": "test"})
|
||||
lc_doc = doc.to_langchain_format()
|
||||
lc_doc = doc.to_vector_format()
|
||||
assert lc_doc.page_content == "hello world"
|
||||
assert lc_doc.metadata == {"source": "test"}
|
||||
|
||||
def test_document_to_langchain_format_no_extra_info(self):
|
||||
"""Cover: to_langchain_format with no extra_info uses empty dict."""
|
||||
def test_document_to_vector_format_no_extra_info(self):
|
||||
"""Cover: to_vector_format with no extra_info uses empty dict."""
|
||||
from application.parser.schema.base import Document
|
||||
|
||||
doc = Document(text="hello")
|
||||
lc_doc = doc.to_langchain_format()
|
||||
lc_doc = doc.to_vector_format()
|
||||
assert lc_doc.metadata == {}
|
||||
|
||||
def test_document_from_langchain_format(self):
|
||||
"""Cover line 34: Document.from_langchain_format creates Document."""
|
||||
def test_document_from_vector_format(self):
|
||||
"""Cover line 34: Document.from_vector_format creates Document."""
|
||||
from application.parser.schema.base import Document
|
||||
from langchain_core.documents import Document as LCDocument
|
||||
from application.vectorstore.document_class import Document as LCDocument
|
||||
|
||||
lc_doc = LCDocument(page_content="test content", metadata={"key": "val"})
|
||||
doc = Document.from_langchain_format(lc_doc)
|
||||
doc = Document.from_vector_format(lc_doc)
|
||||
assert doc.text == "test content"
|
||||
assert doc.extra_info == {"key": "val"}
|
||||
|
||||
|
||||
Reference in new issue
Block a user