mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-12 21:05:18 +03:00
core[patch]: Add unit test for str and repr for Document (#23414)
This commit is contained in:
1 parent
f055f2a1e3
commit
7e9e69c758
1 file changed
+20
@@ -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})"
|
||||
)
|
||||
Reference in new issue
Block a user