Skip to content

Commit

Permalink
test: fix test for record
Browse files Browse the repository at this point in the history
  • Loading branch information
taskingaijc authored and jameszyao committed May 24, 2024
1 parent 082790a commit d0d957d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions test/testcase/test_async/test_async_retrieval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import os

import asyncio
from taskingai.retrieval import *
from taskingai.file import a_upload_file
from taskingai.client.models import UploadFilePurpose
Expand Down Expand Up @@ -393,6 +393,8 @@ async def test_update_chunk(self):
async def test_delete_chunk(self):
# List chunks.

await asyncio.sleep(Config.sleep_time)

chunks = await a_list_chunks(collection_id=self.collection_id, limit=5)
old_nums = len(chunks)
for index, chunk in enumerate(chunks):
Expand All @@ -404,6 +406,6 @@ async def test_delete_chunk(self):

# List chunks.

new_chunks = list_chunks(collection_id=self.collection_id)
new_chunks = await a_list_chunks(collection_id=self.collection_id)
chunk_ids = [chunk.chunk_id for chunk in new_chunks]
pytest.assume(chunk_id not in chunk_ids)
2 changes: 1 addition & 1 deletion test/testcase/test_sync/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def collection_id():
@pytest.fixture(scope="session")
def record_id(collection_id):
res = list_records(str(collection_id))
record_id = res[0].record_id
record_id = res[-1].record_id
return record_id


Expand Down
8 changes: 4 additions & 4 deletions test/testcase/test_sync/test_sync_retrieval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import os

import time
from taskingai.retrieval import TokenTextSplitter, TextSplitter
from taskingai.retrieval import (
list_collections,
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_create_record_by_web(self, collection_id):
res_dict = vars(res)
assume_record_result(create_record_data, res_dict)

@pytest.mark.run(order=31)
@pytest.mark.run(order=32)
@pytest.mark.parametrize("upload_file_data", upload_file_data_list[:2])
def test_create_record_by_file(self, collection_id, upload_file_data):
# upload file
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_update_record_by_web(self, collection_id, record_id, text_splitter):
res_dict = vars(res)
assume_record_result(update_record_data, res_dict)

@pytest.mark.run(order=34)
@pytest.mark.run(order=35)
@pytest.mark.parametrize("upload_file_data", upload_file_data_list[2:3])
def test_update_record_by_file(self, collection_id, record_id, upload_file_data):
# upload file
Expand Down Expand Up @@ -295,7 +295,7 @@ def test_update_record_by_file(self, collection_id, record_id, upload_file_data)
@pytest.mark.run(order=79)
def test_delete_record(self, collection_id):
# List records.

time.sleep(Config.sleep_time)
records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None)
old_nums = len(records)
for index, record in enumerate(records):
Expand Down

0 comments on commit d0d957d

Please sign in to comment.