From 495e9ee6c0b63507fcca8419d5e612ea8b3ab95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Kardos?= Date: Mon, 1 Jul 2024 14:21:46 +0200 Subject: [PATCH] Added test to check whether there are None fields in topic_data --- tests/test_integration.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index 67869b5..4122d03 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -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): @@ -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." + )