Skip to content

Commit

Permalink
test: modify the order function in test cases (#31680)
Browse files Browse the repository at this point in the history
issue: #30694

Signed-off-by: binbin lv <[email protected]>
  • Loading branch information
binbinlv authored Mar 28, 2024
1 parent b99c462 commit 6c6764b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/python_client/testcases/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11886,9 +11886,9 @@ def test_hybrid_search_result_L2_order(self):
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):
Expand Down Expand Up @@ -11917,6 +11917,6 @@ def test_hybrid_search_result_order(self):
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)

0 comments on commit 6c6764b

Please sign in to comment.