@@ -27,21 +27,31 @@ def test_conceptnet(self):
2727 self .assertIsNotNone (conceptnet .edges ("รัก" ))
2828
2929 def test_corpus (self ):
30- self .assertIsNotNone (countries ())
31- self .assertIsNotNone (provinces ())
32- self .assertIsNotNone (thai_negations ())
33- self .assertIsNotNone (thai_stopwords ())
34- self .assertIsNotNone (thai_syllables ())
35- self .assertIsNotNone (thai_words ())
36- self .assertIsNotNone (thai_female_names ())
37- self .assertIsNotNone (thai_male_names ())
38- self .assertEqual (get_corpus_db_detail ("XXX" ), {})
39- self .assertIsNotNone (download ("test" ))
40- self .assertIsNotNone (download ("test" , force = True ))
41- self .assertFalse (download ("XxxXXxxx817d37sf" )) # not exist
42- self .assertIsNotNone (get_corpus_db_detail ("test" ))
43- self .assertIsNotNone (remove ("test" ))
44- self .assertFalse (remove ("test" ))
30+ self .assertTrue (isinstance (thai_negations (), frozenset ))
31+ self .assertTrue (isinstance (thai_stopwords (), frozenset ))
32+ self .assertTrue (isinstance (thai_syllables (), frozenset ))
33+ self .assertTrue (isinstance (thai_words (), frozenset ))
34+
35+ self .assertTrue (isinstance (countries (), frozenset ))
36+ self .assertTrue (isinstance (provinces (), frozenset ))
37+ self .assertTrue (isinstance (thai_female_names (), frozenset ))
38+ self .assertTrue (isinstance (thai_male_names (), frozenset ))
39+
40+ self .assertEqual (
41+ get_corpus_db_detail ("XXX" ), {}
42+ ) # corpus does not exist
43+ self .assertTrue (download ("test" )) # download the first time
44+ self .assertTrue (download (name = "test" , force = True )) # force download
45+ self .assertTrue (download (name = "test" )) # try download existing
46+ self .assertFalse (
47+ download (name = "test" , corpus_db_url = "wrongurl" )
48+ ) # URL not exist
49+ self .assertFalse (
50+ download (name = "XxxXXxxx817d37sf" )
51+ ) # corpus name not exist
52+ self .assertIsNotNone (get_corpus_db_detail ("test" )) # corpus exists
53+ self .assertTrue (remove ("test" )) # remove existing
54+ self .assertFalse (remove ("test" )) # remove non-existing
4555
4656 def test_tnc (self ):
4757 self .assertIsNotNone (tnc .word_freqs ())
@@ -50,7 +60,7 @@ def test_ttc(self):
5060 self .assertIsNotNone (ttc .word_freqs ())
5161
5262 def test_wordnet (self ):
53- self .assertIsNotNone ( wordnet .langs ())
63+ self .assertTrue ( isinstance ( wordnet .langs (), list ))
5464 self .assertTrue ("tha" in wordnet .langs ())
5565
5666 self .assertEqual (
0 commit comments