@@ -106,16 +106,16 @@ async def test_a_update_collection(self):
106106 async def test_a_delete_collection (self ):
107107 # List collections.
108108 old_res = await a_list_collections (order = "desc" , limit = 100 , after = None , before = None )
109-
109+ old_nums = len ( old_res )
110110 for index , collection in enumerate (old_res ):
111111 collection_id = collection .collection_id
112112 # Delete a collection.
113113 await a_delete_collection (collection_id = collection_id )
114-
115- new_collections = await a_list_collections (order = "desc" , limit = 100 , after = None , before = None )
116- # List collections.
117- collection_ids = [ c . collection_id for c in new_collections ]
118- pytest .assume (collection_id not in collection_ids )
114+ if index == old_nums - 1 :
115+ new_collections = await a_list_collections (order = "desc" , limit = 100 , after = None , before = None )
116+ # List collections.
117+ new_nums = len ( new_collections )
118+ pytest .assume (new_nums == 0 )
119119
120120
121121@pytest .mark .test_async
@@ -234,13 +234,13 @@ async def test_a_delete_record(self):
234234 await a_delete_record (collection_id = self .collection_id , record_id = record_id )
235235
236236 # List records.
237-
238- new_records = await a_list_records (collection_id = self .collection_id , order = "desc" , limit = 20 , after = None ,
239- before = None )
240- record_ids = [record .record_id for record in new_records ]
241- pytest .assume (record_id not in record_ids )
242- new_nums = len (new_records )
243- pytest .assume (new_nums == old_nums - 1 - index )
237+ if index == old_nums - 1 :
238+ new_records = await a_list_records (collection_id = self .collection_id , order = "desc" , limit = 20 , after = None ,
239+ before = None )
240+ record_ids = [record .record_id for record in new_records ]
241+ pytest .assume (record_id not in record_ids )
242+ new_nums = len (new_records )
243+ pytest .assume (new_nums == 0 )
244244
245245
246246@pytest .mark .test_async
@@ -352,9 +352,7 @@ async def test_delete_chunk(self):
352352 delete_chunk (collection_id = self .collection_id , chunk_id = chunk_id )
353353
354354 # List chunks.
355-
356- new_chunks = list_chunks (collection_id = self .collection_id )
357- chunk_ids = [chunk .chunk_id for chunk in new_chunks ]
358- pytest .assume (chunk_id not in chunk_ids )
359- new_nums = len (new_chunks )
360- pytest .assume (new_nums == old_nums - 1 - index )
355+ if index == old_nums - 1 :
356+ new_chunks = list_chunks (collection_id = self .collection_id )
357+ new_nums = len (new_chunks )
358+ pytest .assume (new_nums == 0 )
0 commit comments