Skip to content

Commit 0b673a3

Browse files
improve: Prevent stop iteration error caused by next
1 parent 4d3b2d9 commit 0b673a3

6 files changed

+9
-9
lines changed

tests/test_image_onnx_embeddings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_embedding() -> None:
3434
all_models = ImageEmbedding._list_supported_models()
3535

3636
models_to_test = (
37-
[next(model for model in all_models if model.model in CANONICAL_VECTOR_VALUES)]
37+
[model for model in all_models if model.model in CANONICAL_VECTOR_VALUES][:1]
3838
if not is_manual
3939
else all_models
4040
)

tests/test_late_interaction_embeddings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_single_embedding():
177177

178178
all_models = LateInteractionTextEmbedding._list_supported_models()
179179
models_to_test = (
180-
[next(model for model in all_models if model.model in CANONICAL_COLUMN_VALUES)]
180+
[model for model in all_models if model.model in CANONICAL_COLUMN_VALUES][:1]
181181
if not is_manual
182182
else all_models
183183
)
@@ -206,7 +206,7 @@ def test_single_embedding_query():
206206

207207
all_models = LateInteractionTextEmbedding._list_supported_models()
208208
models_to_test = (
209-
[next(model for model in all_models if model.model in CANONICAL_QUERY_VALUES)]
209+
[model for model in all_models if model.model in CANONICAL_QUERY_VALUES][:1]
210210
if not is_manual
211211
else all_models
212212
)

tests/test_sparse_embeddings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_single_embedding() -> None:
7070

7171
all_models = SparseTextEmbedding._list_supported_models()
7272
models_to_test = (
73-
[next(model for model in all_models if model.model in CANONICAL_COLUMN_VALUES)]
73+
[model for model in all_models if model.model in CANONICAL_COLUMN_VALUES][:1]
7474
if not is_manual
7575
else all_models
7676
)

tests/test_text_cross_encoder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_rerank() -> None:
2222

2323
all_models = TextCrossEncoder._list_supported_models()
2424
models_to_test = (
25-
[next(model for model in all_models if model.model in CANONICAL_SCORE_VALUES)]
25+
[model for model in all_models if model.model in CANONICAL_SCORE_VALUES][:1]
2626
if not is_manual
2727
else all_models
2828
)

tests/test_text_multitask_embeddings.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_single_embedding():
9393

9494
all_models = TextEmbedding._list_supported_models()
9595
models_to_test = (
96-
[next(model for model in all_models if model.model in CANONICAL_VECTOR_VALUES)]
96+
[model for model in all_models if model.model in CANONICAL_VECTOR_VALUES][:1]
9797
if not is_manual
9898
else all_models
9999
)
@@ -133,7 +133,7 @@ def test_single_embedding_query():
133133

134134
all_models = TextEmbedding._list_supported_models()
135135
models_to_test = (
136-
[next(model for model in all_models if model.model in CANONICAL_VECTOR_VALUES)]
136+
[model for model in all_models if model.model in CANONICAL_VECTOR_VALUES][:1]
137137
if not is_manual
138138
else all_models
139139
)
@@ -172,7 +172,7 @@ def test_single_embedding_passage():
172172

173173
all_models = TextEmbedding._list_supported_models()
174174
models_to_test = (
175-
[next(model for model in all_models if model.model in CANONICAL_VECTOR_VALUES)]
175+
[model for model in all_models if model.model in CANONICAL_VECTOR_VALUES][:1]
176176
if not is_manual
177177
else all_models
178178
)

tests/test_text_onnx_embeddings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_embedding() -> None:
8080
all_models = TextEmbedding._list_supported_models()
8181

8282
models_to_test = (
83-
[next(model for model in all_models if model.model in CANONICAL_VECTOR_VALUES)]
83+
[model for model in all_models if model.model in CANONICAL_VECTOR_VALUES][:1]
8484
if not is_manual
8585
else all_models
8686
)

0 commit comments

Comments
 (0)