Skip to content

Commit

Permalink
Added test to check whether there are None fields in topic_data
Browse files Browse the repository at this point in the history
  • Loading branch information
x-tabdeveloping committed Jul 1, 2024
1 parent 4a14aa0 commit 495e9ee
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
from sentence_transformers import SentenceTransformer
from sklearn.datasets import fetch_20newsgroups

from turftopic import (
GMM,
AutoEncodingTopicModel,
ClusteringTopicModel,
KeyNMF,
SemanticSignalSeparation,
)
from turftopic import (GMM, AutoEncodingTopicModel, ClusteringTopicModel,
KeyNMF, SemanticSignalSeparation)


def batched(iterable, n: int):
Expand Down Expand Up @@ -133,3 +128,13 @@ def test_fit_online(model):
with out_path.open("w") as out_file:
out_file.write(table)
df = pd.read_csv(out_path)


@pytest.mark.parametrize("model", models)
def test_prepare_topic_data(model):
topic_data = model.prepare_topic_data(texts, embeddings=embeddings)
for key, value in topic_data.items():
if value is None:
raise TypeError(
"None of the fields of prepare_topic_data should be None."
)

0 comments on commit 495e9ee

Please sign in to comment.