-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
40 lines (32 loc) · 1.39 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import unittest
from ja_helper import *
class TestConjugationRecognition(unittest.TestCase):
def test_vx_pol(self):
morphs = parse("曲がります")
self.assertEqual([m.surface() for m in morphs], ["曲がり", "ます"])
M = MultiMorpheme(morphs)
self.assertTrue(M.composition_check())
self.assertEqual(post_parse(morphs), [M])
def test_vx_conditional(self):
morphs = parse("飲んだら")
self.assertEqual([m.surface() for m in morphs], ["飲ん", "だら"])
def test_vvv_progressive(self):
morphs = parse("思っている")
self.assertEqual([m.surface() for m in morphs], ["思っ", "て", "いる"])
M = MultiMorpheme(morphs)
self.assertTrue(M.composition_check())
self.assertEqual(post_parse(morphs), [M])
def test_nss(self):
morphs = parse("大学院生")
self.assertEqual([m.surface() for m in morphs], ["大学", "院", "生"])
M = MultiMorpheme(morphs)
self.assertTrue(M.composition_check())
self.assertEqual(post_parse(morphs), [M])
def test_av(self):
morphs = parse("そういう")
self.assertEqual([m.surface() for m in morphs], ["そう", "いう"])
M = MultiMorpheme(morphs)
self.assertTrue(M.composition_check())
self.assertEqual(post_parse(morphs), [M])
if __name__ == "__main__":
unittest.main()