feat/ 导出开发容器内的数据用于评估
This commit is contained in:
29
api/tests/evaluation/test_importers.py
Normal file
29
api/tests/evaluation/test_importers.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from app.features.evaluation.importers.script_json import parse_script_json
|
||||
from app.features.evaluation.importers.user_export_markdown import (
|
||||
extract_user_utterances_from_export_md,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_script_json_list() -> None:
|
||||
u, meta = parse_script_json('["a", "b"]')
|
||||
assert u == ["a", "b"]
|
||||
assert meta == {}
|
||||
|
||||
|
||||
def test_parse_script_json_object() -> None:
|
||||
u, meta = parse_script_json('{"utterances":["x"],"foo":1}')
|
||||
assert u == ["x"]
|
||||
assert meta == {"foo": 1}
|
||||
|
||||
|
||||
def test_extract_user_lines_from_export_md() -> None:
|
||||
md = """
|
||||
**用户:**
|
||||
|
||||
hello
|
||||
|
||||
**AI:**
|
||||
|
||||
hi
|
||||
"""
|
||||
assert extract_user_utterances_from_export_md(md) == ["hello"]
|
||||
Reference in New Issue
Block a user