Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulia Baldini committed May 31, 2024
1 parent 8738672 commit b9babdd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import unittest

import numpy as np
from sklearn.utils._param_validation import InvalidParameterError

from bico import BICO

np.random.seed(42)


class TestBICO(unittest.TestCase):

example_data = np.random.rand(10000, 10)

def test_fit(self) -> None:

bico = BICO(n_clusters=2, random_state=42, fit_coreset=True)
bico.fit(self.example_data)

assert isinstance(bico.cluster_centers_, np.ndarray)

def test_n_clusters(self) -> None:
bico = BICO(n_clusters=0)

self.assertRaises(InvalidParameterError, bico.fit, self.example_data)


if __name__ == "__main__":
unittest.main()

0 comments on commit b9babdd

Please sign in to comment.