| 123456789101112131415161718192021222324252627282930313233343536 |
- import sys
- import unittest
- from pathlib import Path
- sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
- import audit
- class SharedPrecheckTests(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- kit = audit.Kit(audit.pick_workbook())
- cls.watch_words = kit.watch_words()
- kit.wb.close()
- def test_us_non_watch_continues(self):
- self.assertIsNone(audit.precheck("美国", "陶瓷杯", "Ceramic cup", self.watch_words))
- def test_non_us_and_unknown_stop_at_p1_before_watch(self):
- for country in ("加拿大", "", "未知"):
- with self.subTest(country=country):
- gate = audit.precheck(country, "手表", "WATCH", self.watch_words)
- self.assertEqual(gate[0], "P1")
- self.assertIn("转人工", gate[2])
- def test_watch_names_use_current_workbook_triggers(self):
- for cn, en in (("手表", ""), ("", "Wristwatch"), ("", "SMART WATCH")):
- with self.subTest(cn=cn, en=en):
- gate = audit.precheck("美国", cn, en, self.watch_words)
- self.assertEqual(gate[0], "P2")
- self.assertIn("转人工", gate[2])
- if __name__ == "__main__":
- unittest.main()
|