Add test.py

This commit is contained in:
zy123 2024-10-21 20:46:48 +08:00
parent 54e81af902
commit ff1743487a

24
flask_app/main/test.py Normal file
View File

@ -0,0 +1,24 @@
import re
begin_pattern = re.compile(r'第[一二三四五六七八九十]+章\s*(招标公告|投标须知.*)|(^|\n)第一卷|招标编号:|招标编号:')
# 测试用例
test_cases = [
"第一章 招标公告",
"\n第一章 招标公告", # 在第二行
"第二章 投标须知",
"第三章 投标须知要求",
"第一卷 投标文件格式",
"招标编号: ABC123",
"招标编号DEF456",
"第三章 项目概述",
"第四章 评标办法"
]
# 测试匹配
for i, case in enumerate(test_cases, 1):
match = begin_pattern.search(case)
if match:
print(f"Test case {i}: Matched - '{case}'")
else:
print(f"Test case {i}: Not matched - '{case}'")