chore: 添加虚拟环境到仓库
- 添加 backend_service/venv 虚拟环境 - 包含所有Python依赖包 - 注意:虚拟环境约393MB,包含12655个文件
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from chromadb.api.client import Client
|
||||
from chromadb.config import System
|
||||
from chromadb.test.property import invariants
|
||||
|
||||
|
||||
def test_log_purge(sqlite_persistent: System) -> None:
|
||||
client = Client.from_system(sqlite_persistent)
|
||||
|
||||
first_collection = client.create_collection(
|
||||
"first_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10}
|
||||
)
|
||||
second_collection = client.create_collection(
|
||||
"second_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10}
|
||||
)
|
||||
collections = [first_collection, second_collection]
|
||||
|
||||
# (Does not trigger a purge)
|
||||
for i in range(5):
|
||||
first_collection.add(ids=str(i), embeddings=[i, i])
|
||||
|
||||
# (Should trigger a purge)
|
||||
for i in range(100):
|
||||
second_collection.add(ids=str(i), embeddings=[i, i])
|
||||
|
||||
# The purge of the second collection should not be blocked by the first
|
||||
invariants.log_size_below_max(client._system, collections, True)
|
||||
|
||||
|
||||
def test_log_purge_with_multiple_collections(sqlite_persistent: System) -> None:
|
||||
client = Client.from_system(sqlite_persistent)
|
||||
|
||||
first_collection = client.create_collection(
|
||||
"first_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10}
|
||||
)
|
||||
second_collection = client.create_collection(
|
||||
"second_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10}
|
||||
)
|
||||
collections = [first_collection, second_collection]
|
||||
|
||||
# (Does not trigger a purge)
|
||||
for i in range(15):
|
||||
first_collection.add(ids=str(i), embeddings=[i, i])
|
||||
|
||||
# (Should trigger a purge)
|
||||
for i in range(25):
|
||||
second_collection.add(ids=str(i), embeddings=[i, i])
|
||||
|
||||
invariants.log_size_for_collections_match_expected(
|
||||
client._system, collections, True
|
||||
)
|
||||
Reference in New Issue
Block a user