MCPcopy Create free account
hub / github.com/alibaba/zvec / test_collection_fetch

Method test_collection_fetch

python/tests/test_collection.py:429–443  ·  view source on GitHub ↗
(
        self, collection_with_single_doc: Collection, single_doc: Doc
    )

Source from the content-addressed store, hash-verified

427@pytest.mark.usefixtures("test_collection")
428class TestCollectionFetch:
429 def test_collection_fetch(
430 self, collection_with_single_doc: Collection, single_doc: Doc
431 ):
432 result = collection_with_single_doc.fetch(ids=[single_doc.id])
433 assert bool(result)
434 assert single_doc.id in result.keys()
435
436 doc = result[single_doc.id]
437 assert doc is not None
438 assert doc.id == single_doc.id
439 assert set(doc.field_names()) == set(single_doc.field_names())
440 for field_name in doc.field_names():
441 if field_name in ["dense", "sparse"]:
442 continue
443 assert doc.field(field_name) == single_doc.field(field_name)
444
445 def test_collection_fetch_contains_nodata_ids(
446 self, collection_with_multiple_docs: Collection, multiple_docs: list[Doc]

Callers

nothing calls this directly

Calls 4

field_namesMethod · 0.80
setFunction · 0.50
fetchMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected