jitenbot/tests/test_sankoku_phrases.py

47 lines
2 KiB
Python
Raw Permalink Normal View History

2023-07-18 05:43:38 +00:00
import unittest
from bot.entries.sankoku8.parse import parse_hyouki_pattern
2023-07-18 05:43:38 +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)
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)
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)
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)
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)