Fix: #5719 Added type check for parser_config (#6243)

### What problem does this PR solve?

Fix #5719 
Add data type validation for parser_config

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
liu an
2025-03-18 18:40:06 +08:00
committed by GitHub
parent 7eb417b24f
commit d16033dd2c
2 changed files with 30 additions and 35 deletions

View File

@ -220,21 +220,19 @@ class TestAdvancedConfigurations:
100,
"AssertionError('chunk_token_num should be in range from 1 to 100000000')",
),
pytest.param(
(
"naive_chunk_token_num_float",
"naive",
{"chunk_token_num": 3.14},
102,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
100,
"AssertionError('chunk_token_num should be int')",
),
pytest.param(
(
"naive_chunk_token_num_str",
"naive",
{"chunk_token_num": "1024"},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('chunk_token_num should be int')",
),
(
"naive_layout_recognize_DeepDOC",
@ -261,13 +259,12 @@ class TestAdvancedConfigurations:
),
("naive_delimiter_empty", "naive", {"delimiter": ""}, 0, ""),
("naive_delimiter_backticks", "naive", {"delimiter": "`##`"}, 0, ""),
pytest.param(
(
"naive_delimiter_not_str",
"naive",
{"delimiter": 1},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('delimiter should be str')",
),
(
"naive_task_page_size_negative",
@ -290,21 +287,19 @@ class TestAdvancedConfigurations:
100,
"AssertionError('task_page_size should be in range from 1 to 100000000')",
),
pytest.param(
(
"naive_task_page_size_float",
"naive",
{"task_page_size": 3.14},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('task_page_size should be int')",
),
pytest.param(
(
"naive_task_page_size_str",
"naive",
{"task_page_size": "1024"},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('task_page_size should be int')",
),
("naive_raptor_true", "naive", {"raptor": {"use_raptor": True}}, 0, ""),
("naive_raptor_false", "naive", {"raptor": {"use_raptor": False}}, 0, ""),
@ -329,21 +324,19 @@ class TestAdvancedConfigurations:
100,
"AssertionError('auto_keywords should be in range from 0 to 32')",
),
pytest.param(
(
"naive_auto_keywords_float",
"naive",
{"auto_questions": 3.14},
{"auto_keywords": 3.14},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('auto_keywords should be int')",
),
pytest.param(
(
"naive_auto_keywords_str",
"naive",
{"auto_keywords": "1024"},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('auto_keywords should be int')",
),
(
"naive_auto_questions_negative",
@ -359,21 +352,19 @@ class TestAdvancedConfigurations:
100,
"AssertionError('auto_questions should be in range from 0 to 10')",
),
pytest.param(
(
"naive_auto_questions_float",
"naive",
{"auto_questions": 3.14},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('auto_questions should be int')",
),
pytest.param(
(
"naive_auto_questions_str",
"naive",
{"auto_questions": "1024"},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('auto_questions should be int')",
),
(
"naive_topn_tags_negative",
@ -389,21 +380,19 @@ class TestAdvancedConfigurations:
100,
"AssertionError('topn_tags should be in range from 0 to 10')",
),
pytest.param(
(
"naive_topn_tags_float",
"naive",
{"topn_tags": 3.14},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('topn_tags should be int')",
),
pytest.param(
(
"naive_topn_tags_str",
"naive",
{"topn_tags": "1024"},
100,
"",
marks=pytest.mark.xfail(reason="issue#5719"),
"AssertionError('topn_tags should be int')",
),
],
)