Skip to content

Commit 68890c1

Browse files
committed
Move test_cli_misspell to compact
1 parent 710e116 commit 68890c1

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

tests/compact/test_cli.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
)

tests/core/test_cli.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from pythainlp.cli.soundex import App as SoundexApp
1212
from pythainlp.cli.tag import App as TagApp
1313
from pythainlp.cli.tokenize import App as TokenizeApp
14-
from pythainlp.cli.misspell import App as MisspellApp
1514

1615

1716
class 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-
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ผมไม่ชอบกินผัก ดังนั้นผมจึงมะกจะเลือปทานอาหารท่่มีเนืัอสัตว์เป็นส่วนใหญ่ อย่างไรก็ตาม ผมก็รู้ว่าการทานผักมีประโยชน์ต่อสุขภาพ ดังนั้นฟมจึงพยายามทานผักบ้างในบางมื้อ ดต่ผมก็ยังคงเลือกทานผักที่ผมชอบเท่านั่น อย่างเช่น ถั่วฝักยาว หรือ ถั่วฝักยาว ฐึ่บผมคิดวรามัรก็เปฺนผักืี่อร่อยและมีประโยชา์ด้วย

0 commit comments

Comments
 (0)