Skip to content

Commit e3f3c13

Browse files
authored
refactor(core): use aadd_documents in vectorstores unit tests (#33109)
Don't use the deprecated `upsert()` and `aupsert()` Instead use the recommended alternatives
1 parent c30844f commit e3f3c13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libs/core/tests/unit_tests/vectorstores/test_in_memory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ async def test_inmemory_upsert() -> None:
157157
store = InMemoryVectorStore(embedding=embedding)
158158

159159
# Check sync version
160-
store.upsert([Document(page_content="foo", id="1")])
160+
store.add_documents([Document(page_content="foo", id="1")])
161161
assert sorted(store.store.keys()) == ["1"]
162162

163163
# Check async version
164-
await store.aupsert([Document(page_content="bar", id="2")])
164+
await store.aadd_documents([Document(page_content="bar", id="2")])
165165
assert sorted(store.store.keys()) == ["1", "2"]
166166

167167
# update existing document
168-
await store.aupsert(
168+
await store.aadd_documents(
169169
[Document(page_content="baz", id="2", metadata={"metadata": "value"})]
170170
)
171171
item = store.store["2"]
@@ -183,7 +183,7 @@ async def test_inmemory_get_by_ids() -> None:
183183
"""Test get by ids."""
184184
store = InMemoryVectorStore(embedding=DeterministicFakeEmbedding(size=3))
185185

186-
store.upsert(
186+
store.add_documents(
187187
[
188188
Document(page_content="foo", id="1", metadata={"metadata": "value"}),
189189
Document(page_content="bar", id="2"),

0 commit comments

Comments
 (0)