Skip to content
Snippets Groups Projects
Commit 0f1ecf70 authored by “Daniel Griffiths”'s avatar “Daniel Griffiths”
Browse files

fix: added default values to tfidf tests

parent 6bd5da3b
No related branches found
No related tags found
No related merge requests found
import pytest import pytest
from semantic_router.encoders import TfidfEncoder from semantic_router.encoders import TfidfEncoder
from semantic_router.route import Route from semantic_router.route import Route
import numpy as np
@pytest.fixture @pytest.fixture
...@@ -10,8 +11,8 @@ def tfidf_encoder(): ...@@ -10,8 +11,8 @@ def tfidf_encoder():
class TestTfidfEncoder: class TestTfidfEncoder:
def test_initialization(self, tfidf_encoder): def test_initialization(self, tfidf_encoder):
assert tfidf_encoder.word_index is None assert tfidf_encoder.word_index == {}
assert tfidf_encoder.idf is None assert (tfidf_encoder.idf == np.array([])).all()
def test_fit(self, tfidf_encoder): def test_fit(self, tfidf_encoder):
routes = [ routes = [
...@@ -21,8 +22,8 @@ class TestTfidfEncoder: ...@@ -21,8 +22,8 @@ class TestTfidfEncoder:
) )
] ]
tfidf_encoder.fit(routes) tfidf_encoder.fit(routes)
assert tfidf_encoder.word_index is not None assert tfidf_encoder.word_index != {}
assert tfidf_encoder.idf is not None assert not np.array_equal(tfidf_encoder.idf, np.array([]))
def test_call_method(self, tfidf_encoder): def test_call_method(self, tfidf_encoder):
routes = [ routes = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment