增加环绕侦察场景适配

This commit is contained in:
2026-01-08 15:44:38 +08:00
parent 3eba1f962b
commit 10c5bb5a8a
5441 changed files with 40219 additions and 379695 deletions

View File

@@ -31,7 +31,7 @@ from chromadb.utils.embedding_functions import (
)
from chromadb.api.models.Collection import Collection
from chromadb.api.models.CollectionCommon import CollectionCommon
from chromadb.errors import InvalidArgumentError, InternalError
from chromadb.errors import InvalidArgumentError
from chromadb.execution.expression import Knn, Search
from chromadb.types import Collection as CollectionModel
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, cast
@@ -509,7 +509,7 @@ def test_sparse_vector_not_allowed_locally(
schema = Schema()
schema.create_index(key="sparse_metadata", config=SparseVectorIndexConfig())
with pytest.raises(
InternalError, match="Sparse vector indexing is not enabled in local"
InvalidArgumentError, match="Sparse vector indexing is not enabled in local"
):
_create_isolated_collection(client_factories, schema=schema)
@@ -1011,12 +1011,26 @@ def test_collection_fork_inherits_and_isolates_schema(
client_factories,
schema=schema,
)
parent_version_before_add = get_collection_version(client, collection.name)
parent_ids = [f"parent-{i}" for i in range(251)]
parent_docs = [f"parent doc {i}" for i in range(251)]
parent_metadatas: List[Mapping[str, Any]] = [
{"shared_key": f"parent_{i}"} for i in range(251)
]
collection.add(
ids=["parent-1"],
documents=["parent doc"],
metadatas=[{"shared_key": "parent"}],
ids=parent_ids,
documents=parent_docs,
metadatas=parent_metadatas,
)
# Wait for parent to compact before forking. Otherwise, the fork inherits
# uncompacted logs, and compaction of those inherited logs could increment
# the fork's version before the fork's own data is compacted.
wait_for_version_increase(client, collection.name, parent_version_before_add)
assert collection.schema is not None
parent_schema_json = collection.schema.serialize_to_json()
@@ -1050,8 +1064,8 @@ def test_collection_fork_inherits_and_isolates_schema(
assert reloaded_parent.schema is not None
assert "child_only" not in reloaded_parent.schema.keys
parent_results = reloaded_parent.get(where={"shared_key": "parent"})
assert set(parent_results["ids"]) == {"parent-1"}
parent_results = reloaded_parent.get(where={"shared_key": "parent_10"})
assert set(parent_results["ids"]) == {"parent-10"}
child_results = forked.get(where={"child_only": "value_10"})
assert set(child_results["ids"]) == {"fork-10"}