Skip to content

Commit 91c4e3c

Browse files
committed
Fix custom-label delete test after topic remapping.
Deleting topic 0 still leaves a topic 0 because remaining topics are renumbered by frequency.
1 parent 1c22736 commit 91c4e3c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/test_reduction/test_delete.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ def test_delete_keeps_custom_labels(model, request):
7474

7575
remaining = [topic for topic in sorted(set(topic_model.topics_)) if topic != -1]
7676
topic_to_delete = remaining[0]
77+
before = len(set(topic_model.topics_))
7778

7879
topic_model.delete_topics([topic_to_delete])
7980

8081
unique_topics = sorted(set(topic_model.topics_))
8182
assert isinstance(topic_model.custom_labels_, list)
8283
assert len(topic_model.custom_labels_) == len(unique_topics)
83-
assert topic_to_delete not in unique_topics
84+
# Remaining topics are remapped by frequency, so the deleted id can reappear.
85+
assert len(unique_topics) < before

0 commit comments

Comments
 (0)