File tree Expand file tree Collapse file tree 3 files changed +37
-23
lines changed
Expand file tree Collapse file tree 3 files changed +37
-23
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ # SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project
3+ # SPDX-FileType: SOURCE
4+ # SPDX-License-Identifier: Apache-2.0
5+ """
6+ Unit tests for pythainlp.cli module. (compact)
7+ """
8+
9+ import unittest
10+
11+ from pythainlp import __main__ , cli
12+ from pythainlp .cli .misspell import App as MisspellApp
13+
14+
15+ class CliTestCase (unittest .TestCase ):
16+ def test_cli_misspell (self ):
17+ self .assertTrue (hasattr (cli , "misspell" ))
18+
19+ with self .assertRaises (SystemExit ) as ex :
20+ MisspellApp (["thainlp" , "misspell" ])
21+ self .assertEqual (ex .exception .code , 2 )
22+
23+ self .assertIsNotNone (
24+ MisspellApp (
25+ [
26+ "thainlp" ,
27+ "misspell" ,
28+ "--file" ,
29+ "./tests/data/text.txt" ,
30+ "--seed" ,
31+ "1" ,
32+ "--misspell-ratio" ,
33+ "0.05" ,
34+ ]
35+ )
36+ )
Original file line number Diff line number Diff line change 1111from pythainlp .cli .soundex import App as SoundexApp
1212from pythainlp .cli .tag import App as TagApp
1313from pythainlp .cli .tokenize import App as TokenizeApp
14- from pythainlp .cli .misspell import App as MisspellApp
1514
1615
1716class CliTestCase (unittest .TestCase ):
@@ -140,25 +139,3 @@ def test_cli_tokenize(self):
140139 ]
141140 )
142141 )
143-
144- def test_cli_misspell (self ):
145- self .assertTrue (hasattr (cli , "misspell" ))
146-
147- with self .assertRaises (SystemExit ) as ex :
148- MisspellApp (["thainlp" , "misspell" ])
149- self .assertEqual (ex .exception .code , 2 )
150-
151- self .assertIsNotNone (
152- MisspellApp (
153- [
154- "thainlp" ,
155- "misspell" ,
156- "--file" ,
157- "./tests/data/text.txt" ,
158- "--seed" ,
159- "1" ,
160- "--misspell-ratio" ,
161- "0.05" ,
162- ]
163- )
164- )
Original file line number Diff line number Diff line change 1+ ผมไม่ชอบกินผัก ดังนั้นผมจึงมะกจะเลือปทานอาหารท่่มีเนืัอสัตว์เป็นส่วนใหญ่ อย่างไรก็ตาม ผมก็รู้ว่าการทานผักมีประโยชน์ต่อสุขภาพ ดังนั้นฟมจึงพยายามทานผักบ้างในบางมื้อ ดต่ผมก็ยังคงเลือกทานผักที่ผมชอบเท่านั่น อย่างเช่น ถั่วฝักยาว หรือ ถั่วฝักยาว ฐึ่บผมคิดวรามัรก็เปฺนผักืี่อร่อยและมีประโยชา์ด้วย
You can’t perform that action at this time.
0 commit comments