From 6c6764bcad36e9b15e613cfbc920492f64135458 Mon Sep 17 00:00:00 2001 From: binbin <83755740+binbinlv@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:37:10 +0800 Subject: [PATCH] test: modify the order function in test cases (#31680) issue: #30694 Signed-off-by: binbin lv --- tests/python_client/testcases/test_search.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/python_client/testcases/test_search.py b/tests/python_client/testcases/test_search.py index f0c248554a..e7d078f423 100644 --- a/tests/python_client/testcases/test_search.py +++ b/tests/python_client/testcases/test_search.py @@ -11886,9 +11886,9 @@ class TestCollectionHybridSearchValid(TestcaseBase): req = AnnSearchRequest(**search_param) req_list.append(req) # 4. hybrid search - res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10) - is_sorted_decrease = lambda lst: all(lst[i]['distance'] >= lst[i+1]['distance'] for i in range(len(lst)-1)) - assert is_sorted_decrease(res[0]) + res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)[0] + is_sorted_ascend = lambda lst: all(lst[i] <= lst[i+1] for i in range(len(lst)-1)) + assert is_sorted_ascend(res[0].distances) @pytest.mark.tags(CaseLabel.L1) def test_hybrid_search_result_order(self): @@ -11917,6 +11917,6 @@ class TestCollectionHybridSearchValid(TestcaseBase): req = AnnSearchRequest(**search_param) req_list.append(req) # 4. hybrid search - res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10) - is_sorted_ascend = lambda lst: all(lst[i]['distance'] <= lst[i+1]['distance'] for i in range(len(lst)-1)) - assert is_sorted_ascend(res[0]) + res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)[0] + is_sorted_descend = lambda lst: all(lst[i] >= lst[i+1] for i in range(len(lst)-1)) + assert is_sorted_descend(res[0].distances)