陆运选项不全时改为复制填空清单,方便销售按编号回填。
停发填写样例图,同群只跟当前工单,重量体积统一为 KG/CBM。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
陆运选项单测:三项各自必填、不联动;中港拆进运输类型;样例表跟类型/线路缺项走。
|
||||
陆运选项单测:三项各自必填、不联动;中港拆进运输类型;补问只发复制清单,不再发填写样例图。
|
||||
|
||||
不连企微、主账、TMS。
|
||||
"""
|
||||
@@ -108,48 +108,49 @@ class LandOptionsTest(unittest.TestCase):
|
||||
|
||||
def test_full_prompt_when_empty(self):
|
||||
text = option_prompt(current={})
|
||||
self.assertIn("请一次选择:运输类型、线路类别、运输分类", text)
|
||||
self.assertIn("运输类型(必填):可选择回复,", text)
|
||||
self.assertIn("中港整车", text)
|
||||
self.assertIn("中港零担/集拼", text)
|
||||
self.assertIn("线路类别(必填):可选择回复,", text)
|
||||
self.assertIn("国内长途/零担", text)
|
||||
self.assertIn("1.普件(东南亚、中港常用线路/常规车型)", text)
|
||||
self.assertIn("填写样例见图", text)
|
||||
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
|
||||
self.assertIn("Step2:在粘贴内容的每个字段的冒号后,回复数字或文字,告诉我对应字段的值:", text)
|
||||
self.assertIn("---请复制以下内容---\n运输类型(必填):", text)
|
||||
self.assertIn("运输类型(必填):\n1.国内运输拼车", text)
|
||||
self.assertIn("6.中港零担/集拼", text)
|
||||
self.assertIn("线路类别(必填):\n1.1国内长途/零担", text)
|
||||
self.assertIn("6.1中港/中亚/中欧", text)
|
||||
self.assertIn("运输分类(必填):\n1.普件(东南亚、中港常用线路/常规车型)", text)
|
||||
self.assertIn("4.急件", text)
|
||||
self.assertNotIn("请一次选择:运输类型", text)
|
||||
self.assertNotIn("可选择回复", text)
|
||||
self.assertNotIn("填写样例见图", text)
|
||||
self.assertNotIn("国内运输整车 + 国内城配/拖车/打包", text)
|
||||
self.assertNotIn("┌", text)
|
||||
self.assertNotIn("| 国内运输整车 |", text)
|
||||
self.assertNotIn("仅供参考", text)
|
||||
self.assertNotIn("中港装载方式", text)
|
||||
self.assertNotIn("跟运输类型联动", text)
|
||||
|
||||
def test_copy_alias_lists_new_types(self):
|
||||
from agent.policy import inquiry_copy as copy
|
||||
|
||||
text = copy.ASK_LAND_SUBTYPE
|
||||
self.assertIn("中港整车", text)
|
||||
self.assertIn("填写样例", text)
|
||||
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
|
||||
self.assertIn("---请复制以下内容---", text)
|
||||
self.assertNotIn("请补充陆运类型:国内运输拼车", text)
|
||||
|
||||
def test_sample_table_when_route_missing(self):
|
||||
text = option_prompt(current={"运输类型": "国内运输拼车"})
|
||||
self.assertIn("线路类别(必填)", text)
|
||||
self.assertIn("填写样例见图", text)
|
||||
self.assertTrue(option_prompt_needs_sample(current={"运输类型": "国内运输拼车"}))
|
||||
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
|
||||
self.assertIn("---请复制以下内容---\n线路类别(必填):", text)
|
||||
self.assertIn("线路类别(必填):\n1.1国内长途/零担", text)
|
||||
self.assertIn("运输分类(必填):\n1.普件", text)
|
||||
self.assertFalse(option_prompt_needs_sample(current={"运输类型": "国内运输拼车"}))
|
||||
self.assertFalse(option_prompt_needs_sample(current={}))
|
||||
self.assertNotIn("国内运输拼车 + 国内长途/零担", text)
|
||||
self.assertNotIn("请一次选择:运输类型", text)
|
||||
self.assertNotIn("运输类型(必填)", text)
|
||||
|
||||
def test_sample_pairs_go_to_image_not_text(self):
|
||||
from agent.policy import inquiry_copy as copy
|
||||
|
||||
text = option_prompt(current={})
|
||||
self.assertIn("填写样例见图", text)
|
||||
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
|
||||
self.assertIn("---请复制以下内容---", text)
|
||||
self.assertNotIn("填写样例见图", text)
|
||||
self.assertNotIn("填写样例", text)
|
||||
self.assertNotIn("国内运输拼车 + 国内长途/零担", text)
|
||||
extra = copy.land_sample_image_payload()
|
||||
self.assertEqual(extra.get("msgtype"), "image")
|
||||
self.assertTrue(os.path.isfile(str(extra.get("filepath") or "")))
|
||||
self.assertGreater(os.path.getsize(str(extra["filepath"])), 1000)
|
||||
|
||||
def test_no_sample_when_only_class_missing(self):
|
||||
text = option_prompt(
|
||||
@@ -179,6 +180,30 @@ class LandOptionsTest(unittest.TestCase):
|
||||
self.assertNotIn("目的港", out)
|
||||
self.assertEqual(out.get("品名"), "衣服")
|
||||
|
||||
def test_paste_numbers_and_codes(self):
|
||||
"""复制清单后在冒号后填数字/编号,要收到标准项。"""
|
||||
pasted = (
|
||||
"运输类型(必填):2\n"
|
||||
"线路类别(必填):2.1\n"
|
||||
"运输分类(必填):4"
|
||||
)
|
||||
got = harvest_land_options(pasted)
|
||||
self.assertEqual(got.get("运输类型"), "国内运输整车")
|
||||
self.assertEqual(got.get("线路类别"), "国内长途/零担")
|
||||
self.assertEqual(got.get("运输分类"), "急件")
|
||||
|
||||
def test_route_code_infers_type_when_empty(self):
|
||||
got = harvest_land_options("1.1")
|
||||
self.assertEqual(got.get("运输类型"), "国内运输拼车")
|
||||
self.assertEqual(got.get("线路类别"), "国内长途/零担")
|
||||
|
||||
def test_unfilled_prompt_does_not_eat_menu(self):
|
||||
"""原样粘贴未填的清单,不能把选项名当成已选。"""
|
||||
got = harvest_land_options(option_prompt(current={}))
|
||||
self.assertFalse(got.get("运输类型"))
|
||||
self.assertFalse(got.get("线路类别"))
|
||||
self.assertFalse(got.get("运输分类"))
|
||||
|
||||
def test_confirm_intent(self):
|
||||
self.assertTrue(looks_like_confirm("确认"))
|
||||
self.assertTrue(looks_like_confirm("可以查了"))
|
||||
|
||||
Reference in New Issue
Block a user