fixbug: unit test

This commit is contained in:
莘权 马 2023-07-28 14:18:21 +08:00
parent 9d1a261bf6
commit 5725296b1c
2 changed files with 42 additions and 3 deletions

38
requirements-test.txt Normal file
View file

@ -0,0 +1,38 @@
aiohttp==3.8.4
#azure_storage==0.37.0
channels==4.0.0
# chromadb==0.3.22
# Django==4.1.5
# docx==0.2.4
duckduckgo_search==2.9.4
#faiss==1.5.3
faiss_cpu==1.7.4
fire==0.4.0
# godot==0.1.1
# google_api_python_client==2.93.0
langchain==0.0.231
loguru==0.6.0
meilisearch==0.21.0
numpy==1.24.3
openai==0.27.8
openpyxl
pandas==1.4.1
pydantic==1.10.7
#pygame==2.1.3
#pymilvus==2.2.8
pytest==7.2.2
python_docx==0.8.11
PyYAML==6.0
# sentence_transformers==2.2.2
setuptools==65.6.3
tenacity==8.2.2
tiktoken==0.3.3
tqdm==4.64.0
#unstructured[local-inference]
# playwright
# selenium>4
# webdriver_manager<3.9
anthropic==0.3.6
typing-inspect==0.8.0
typing_extensions==4.5.0
aiofiles

View file

@ -19,7 +19,7 @@ def test_init():
goal: str
constraints: str
desc: str
options: Optional[Dict] = None
kwargs: Optional[Dict] = None
expect_name: str
expect_profile: str
expect_goal: str
@ -36,7 +36,7 @@ def test_init():
"expect_goal": "Do sleep, CN",
"constraints": "Do in {key1}, {language}",
"expect_constraints": "Do in HaHa, CN",
"options": {"language": "CN", "key1": "HaHa", "something_big": "sleep", "teaching_language": "EN"},
"kwargs": {"language": "CN", "key1": "HaHa", "something_big": "sleep", "teaching_language": "EN"},
"desc": "aaa{language}",
"expect_desc": "aaaCN"
},
@ -49,6 +49,7 @@ def test_init():
"expect_goal": "Do {something_big}, Chinese",
"constraints": "Do in {key1}, {language}",
"expect_constraints": "Do in {key1}, Chinese",
"kwargs": {},
"desc": "aaa{language}",
"expect_desc": "aaaChinese"
},
@ -57,7 +58,7 @@ def test_init():
for i in inputs:
seed = Inputs(**i)
teacher = Teacher(name=seed.name, profile=seed.profile, goal=seed.goal, constraints=seed.constraints,
desc=seed.desc, options=seed.options)
desc=seed.desc, **seed.kwargs)
assert teacher.name == seed.expect_name
assert teacher.desc == seed.expect_desc
assert teacher.profile == seed.expect_profile