Skip to content

Commit 0513cea

Browse files
committed
Update test suites
1 parent becced0 commit 0513cea

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

pythainlp/spell/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"correct",
1212
"correct_sent",
1313
"spell",
14-
"SENT_TOKS",
14+
"spell_sent",
1515
]
1616

1717
from pythainlp.spell.pn import NorvigSpellChecker
1818

1919
DEFAULT_SPELL_CHECKER = NorvigSpellChecker()
2020

2121
# these imports are placed here to avoid circular imports
22-
from pythainlp.spell.core import correct, correct_sent, spell, SENT_TOKS
22+
from pythainlp.spell.core import correct, correct_sent, spell, spell_sent

pythainlp/spell/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def correct(word: str, engine: str = "pn") -> str:
129129
return text_correct
130130

131131

132-
def SENT_TOKS(list_words: List[str], engine: str = "pn") -> List[List[str]]:
132+
def spell_sent(list_words: List[str], engine: str = "pn") -> List[List[str]]:
133133
"""
134134
Provides a list of possible correct spellings of sentence
135135
@@ -188,4 +188,4 @@ def correct_sent(list_words: List[str], engine: str = "pn") -> List[str]:
188188
correct_sent(["เด็","อินอร์เน็ต","แรง"],engine='symspellpy')
189189
# output: ['เด็ก', 'อินเทอร์เน็ต', 'แรง']
190190
"""
191-
return SENT_TOKS(list_words, engine=engine)[0]
191+
return spell_sent(list_words, engine=engine)[0]

tests/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
"""
99

1010
import sys
11-
from unittest import TestLoader, TestSuite, TextTestRunner
12-
11+
from unittest import TestLoader, TestSuite
1312

1413
test_packages = [
14+
"tests.test_cli.TestMainPackage",
15+
"tests.test_soundex.TestSoundexPackage",
1516
"tests.test_spell.TestSpellPackage",
1617
"tests.test_tokenize.TestTokenizePackage",
1718
"tests.test_util.TestUtilPackage",
1819
]
1920

21+
2022
def load_tests(loader: TestLoader, tests, pattern: str) -> TestSuite:
2123
"""A function to load tests."""
2224
suite = TestSuite()

tests/test_tokenize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_Tokenizer(self):
214214
_tokenizer = Tokenizer()
215215
self.assertEqual(_tokenizer.word_tokenize("ก"), ["ก"])
216216
with self.assertRaises(NotImplementedError):
217-
Tokenizer(engine="catcut")
217+
Tokenizer(engine="catcut888")
218218

219219
def test_sent_tokenize(self):
220220
self.assertEqual(sent_tokenize(None), [])

0 commit comments

Comments
 (0)