TST Avoid raising a spurious warning in test_kernel_approximation.py
diff --git a/sklearn/tests/test_kernel_approximation.py b/sklearn/tests/test_kernel_approximation.py
index 42e82e4dd36ff..f864214e49504 100644
--- a/sklearn/tests/test_kernel_approximation.py
+++ b/sklearn/tests/test_kernel_approximation.py
@@ -303,11 +303,11 @@ def logging_histogram_kernel(x, y, log):
     ).fit(X)
     assert len(kernel_log) == n_samples * (n_samples - 1) / 2
 
-    # if degree, gamma or coef0 is passed, we raise a warning
+    # if degree, gamma or coef0 is passed, we raise a ValueError
     msg = "Don't pass gamma, coef0 or degree to Nystroem"
     params = ({"gamma": 1}, {"coef0": 1}, {"degree": 2})
     for param in params:
-        ny = Nystroem(kernel=_linear_kernel, **param)
+        ny = Nystroem(kernel=_linear_kernel, n_components=(n_samples - 1), **param)
         with pytest.raises(ValueError, match=msg):
             ny.fit(X)
 

Remove a spurious warning related to the size of `n_components` compared to `n_samples` in `test_nystroem_callable`.