Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Javtor committed Dec 20, 2024
1 parent 9219e22 commit a742767
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions llama-index-core/tests/schema/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,34 @@ def test_document_legacy_roundtrip():
assert dest.text == "this is a test"


def test_document_exclude_text():
doc = Document(id_="test_id", text="this is a test")
model_dump = doc.model_dump(exclude={"text"})
assert "text" not in model_dump
assert doc.model_dump(exclude={"text"}) == {
"id_": "test_id",
"embedding": None,
"metadata": {},
"excluded_embed_metadata_keys": [],
"excluded_llm_metadata_keys": [],
"relationships": {},
"metadata_template": "{key}: {value}",
"metadata_separator": "\n",
"text_resource": {
"embeddings": None,
"text": "this is a test",
"mimetype": None,
"path": None,
"url": None,
},
"image_resource": None,
"audio_resource": None,
"video_resource": None,
"text_template": "{metadata_str}\n\n{content}",
"class_name": "Document",
}


def test_image_document_empty():
doc = ImageDocument(id_="test")
assert doc.id_ == "test"
Expand Down

0 comments on commit a742767

Please sign in to comment.