mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 06:28:58 +08:00
### What problem does this PR solve? PR #6405 #6504 #6538 ### Type of change - [x] update test cases
This commit is contained in:
parent
b7d7ad536a
commit
6599db1e99
@ -28,7 +28,7 @@ def validate_chunk_details(dataset_id, document_id, payload, res):
|
|||||||
if "important_keywords" in payload:
|
if "important_keywords" in payload:
|
||||||
assert chunk["important_keywords"] == payload["important_keywords"]
|
assert chunk["important_keywords"] == payload["important_keywords"]
|
||||||
if "questions" in payload:
|
if "questions" in payload:
|
||||||
assert chunk["questions"] == payload["questions"]
|
assert chunk["questions"] == [str(q).strip() for q in payload.get("questions", []) if str(q).strip()]
|
||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@ -119,12 +119,7 @@ class TestAddChunk:
|
|||||||
"payload, expected_code, expected_message",
|
"payload, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
({"content": "chunk test", "questions": ["a", "b", "c"]}, 0, ""),
|
({"content": "chunk test", "questions": ["a", "b", "c"]}, 0, ""),
|
||||||
pytest.param(
|
({"content": "chunk test", "questions": [""]}, 0, ""),
|
||||||
{"content": "chunk test", "questions": [""]},
|
|
||||||
0,
|
|
||||||
"",
|
|
||||||
marks=pytest.mark.skip(reason="issues/6404"),
|
|
||||||
),
|
|
||||||
({"content": "chunk test", "questions": [1]}, 100, "TypeError('sequence item 0: expected str instance, int found')"),
|
({"content": "chunk test", "questions": [1]}, 100, "TypeError('sequence item 0: expected str instance, int found')"),
|
||||||
({"content": "chunk test", "questions": ["a", "a"]}, 0, ""),
|
({"content": "chunk test", "questions": ["a", "a"]}, 0, ""),
|
||||||
({"content": "chunk test", "questions": "abc"}, 102, "`questions` is required to be a list"),
|
({"content": "chunk test", "questions": "abc"}, 102, "`questions` is required to be a list"),
|
||||||
@ -138,6 +133,7 @@ class TestAddChunk:
|
|||||||
assert False, res
|
assert False, res
|
||||||
chunks_count = res["data"]["doc"]["chunk_count"]
|
chunks_count = res["data"]["doc"]["chunk_count"]
|
||||||
res = add_chunk(get_http_api_auth, dataset_id, document_id, payload)
|
res = add_chunk(get_http_api_auth, dataset_id, document_id, payload)
|
||||||
|
print(res)
|
||||||
assert res["code"] == expected_code
|
assert res["code"] == expected_code
|
||||||
if expected_code == 0:
|
if expected_code == 0:
|
||||||
validate_chunk_details(dataset_id, document_id, payload, res)
|
validate_chunk_details(dataset_id, document_id, payload, res)
|
||||||
|
@ -109,7 +109,7 @@ class TestChunksList:
|
|||||||
[
|
[
|
||||||
(None, 0, 5, ""),
|
(None, 0, 5, ""),
|
||||||
("", 0, 5, ""),
|
("", 0, 5, ""),
|
||||||
pytest.param(lambda r: r[0], 0, 1, "", marks=pytest.mark.skip(reason="issues/6499")),
|
pytest.param(lambda r: r[0], 0, 1, "", marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="issues/6499")),
|
||||||
pytest.param("unknown", 100, 0, """AttributeError("\'NoneType\' object has no attribute \'keys\'")""", marks=pytest.mark.skip),
|
pytest.param("unknown", 100, 0, """AttributeError("\'NoneType\' object has no attribute \'keys\'")""", marks=pytest.mark.skip),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user