Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Mark KNN tests as extra (#9844)

Isaac Millerb2829b7ae3b6
diff --git a/tests/predict/test_knn.py b/tests/predict/test_knn.py
index be22fdd12..902ecc4f4 100644
--- a/tests/predict/test_knn.py
+++ b/tests/predict/test_knn.py
@@ -1,10 +1,11 @@
-import numpy as np
import pytest
import dspy
from dspy.predict import KNN
from dspy.utils import DummyVectorizer
+pytestmark = pytest.mark.extra
+
def mock_example(question: str, answer: str) -> dspy.Example:
"""Creates a mock DSP example with specified question and answer."""
@@ -24,6 +25,8 @@ def setup_knn() -> KNN:
def test_knn_initialization(setup_knn):
"""Tests the KNN initialization and checks if the trainset vectors are correctly created."""
+ import numpy as np
+
knn = setup_knn
assert knn.k == 2, "Incorrect k value"
assert len(knn.trainset_vectors) == 3, "Incorrect size of trainset vectors"