Skip to content

Commit

Permalink
core[patch]: Add unit test for str and repr for Document (#23414)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Jun 25, 2024
1 parent f055f2a commit 7e9e69c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions libs/core/tests/unit_tests/documents/test_str.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from langchain_core.documents import Document


def test_str() -> None:
assert str(Document(page_content="Hello, World!")) == "page_content='Hello, World!'"
assert (
str(Document(page_content="Hello, World!", metadata={"a": 3}))
== "page_content='Hello, World!' metadata={'a': 3}"
)


def test_repr() -> None:
assert (
repr(Document(page_content="Hello, World!"))
== "Document(page_content='Hello, World!')"
)
assert (
repr(Document(page_content="Hello, World!", metadata={"a": 3}))
== "Document(page_content='Hello, World!', metadata={'a': 3})"
)

0 comments on commit 7e9e69c

Please sign in to comment.