From 2f3e9fae2c06dd8886a69fa968a6b69ec517632f Mon Sep 17 00:00:00 2001 From: "yue.jiao" Date: Wed, 18 Dec 2024 14:11:20 -0800 Subject: [PATCH] fix: const test check shape instead of str output --- sklearnex/manifold/tests/test_tsne.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sklearnex/manifold/tests/test_tsne.py b/sklearnex/manifold/tests/test_tsne.py index 90506aac03..0c0f7930db 100755 --- a/sklearnex/manifold/tests/test_tsne.py +++ b/sklearnex/manifold/tests/test_tsne.py @@ -84,9 +84,9 @@ def test_basic_tsne_functionality(): # Edge case: constant data X_constant = np.ones((10, 10)) - with pytest.raises(ValueError) as excinfo: - TSNE(n_components=2, perplexity=20).fit(X_constant) - assert "perplexity must be less than n_samples" in str(excinfo.value) + tsne = TSNE(n_components=2, perplexity=5, random_state=42) + embedding = tsne.fit(X_constant).embedding_ + assert embedding.shape == (10, 2), f"Unexpected embedding shape: {embedding.shape}" # Edge case: empty data X_empty = np.empty((0, 10))