mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
core[patch]: Add unit test for str and repr for Document (#23414)
This commit is contained in:
parent
f055f2a1e3
commit
7e9e69c758
20
libs/core/tests/unit_tests/documents/test_str.py
Normal file
20
libs/core/tests/unit_tests/documents/test_str.py
Normal file
@ -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})"
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user