2023-07-18 05:43:38 +00:00
|
|
|
import unittest
|
2023-07-27 00:28:50 +00:00
|
|
|
from bot.entries.sankoku8.parse import parse_hyouki_pattern
|
2023-07-18 05:43:38 +00:00
|
|
|
|
|
|
|
|
2023-07-27 00:28:50 +00:00
|
|
|
class TestSankoku8PhraseParse(unittest.TestCase):
|
|
|
|
def test1(self):
|
2023-07-18 05:43:38 +00:00
|
|
|
pattern = '耳にたこ(ができる)'
|
|
|
|
exps = parse_hyouki_pattern(pattern)
|
|
|
|
self.assertEqual(len(exps), 2)
|
|
|
|
self.assertIn("耳にたこ", exps)
|
|
|
|
self.assertIn("耳にたこができる", exps)
|
|
|
|
|
2023-07-27 00:28:50 +00:00
|
|
|
def test2(self):
|
2023-07-18 05:43:38 +00:00
|
|
|
pattern = '一斑を〈見て/もって〉全豹を〈卜す/推す〉'
|
|
|
|
exps = parse_hyouki_pattern(pattern)
|
|
|
|
self.assertEqual(len(exps), 4)
|
|
|
|
self.assertIn("一斑を見て全豹を卜す", exps)
|
|
|
|
self.assertIn("一斑を見て全豹を推す", exps)
|
|
|
|
self.assertIn("一斑をもって全豹を卜す", exps)
|
|
|
|
self.assertIn("一斑をもって全豹を推す", exps)
|
|
|
|
|
2023-07-27 00:28:50 +00:00
|
|
|
def test3(self):
|
2023-07-18 05:43:38 +00:00
|
|
|
pattern = '{かじ・舵}を切る'
|
|
|
|
exps = parse_hyouki_pattern(pattern)
|
|
|
|
self.assertEqual(len(exps), 2)
|
|
|
|
self.assertIn("かじを切る", exps)
|
|
|
|
self.assertIn("舵を切る", exps)
|
|
|
|
|
2023-07-27 00:28:50 +00:00
|
|
|
def test4(self):
|
2023-07-18 05:43:38 +00:00
|
|
|
pattern = '重箱の隅を(⦅ようじ\楊枝⦆で)〈つつく/ほじくる〉'
|
|
|
|
exps = parse_hyouki_pattern(pattern)
|
|
|
|
self.assertEqual(len(exps), 6)
|
|
|
|
self.assertIn("重箱の隅をつつく", exps)
|
|
|
|
self.assertIn("重箱の隅をようじでつつく", exps)
|
|
|
|
self.assertIn("重箱の隅を楊枝でつつく", exps)
|
|
|
|
self.assertIn("重箱の隅をほじくる", exps)
|
|
|
|
self.assertIn("重箱の隅をようじでほじくる", exps)
|
|
|
|
self.assertIn("重箱の隅を楊枝でほじくる", exps)
|
|
|
|
|
2023-07-27 00:28:50 +00:00
|
|
|
def test5(self):
|
2023-07-18 05:43:38 +00:00
|
|
|
pattern = '群盲象を〈{な・撫}でる/評する〉'
|
|
|
|
exps = parse_hyouki_pattern(pattern)
|
|
|
|
self.assertEqual(len(exps), 3)
|
|
|
|
self.assertIn("群盲象をなでる", exps)
|
|
|
|
self.assertIn("群盲象を撫でる", exps)
|
|
|
|
self.assertIn("群盲象を評する", exps)
|