Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
bryant1410 committed Mar 16, 2024
1 parent 2dec414 commit b3f81f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nltk/test/unit/test_wordnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,12 @@ def test_iterable_type_for_all_lemma_names(self):
self.assertTrue(hasattr(cat_lemmas, "__iter__"))
self.assertTrue(hasattr(cat_lemmas, "__next__") or hasattr(eng_lemmas, "next"))
self.assertTrue(cat_lemmas.__iter__() is cat_lemmas)

def test_disabled_sorting_and_list(self):
lemmas = S("water.n.1").substance_meronyms(sort=False, force_list=False)
self.assertTrue(not isinstance(lemmas, list))
self.assertTrue(hasattr(lemmas, "__iter__"))
self.assertEqual(
set(lemmas),
{S("hydrogen.n.01"), S("oxygen.n.01")},
)

0 comments on commit b3f81f0

Please sign in to comment.