添加单元测试

pull/547/head
Whitroom 2023-04-12 16:04:47 +08:00
parent 14f73a2efe
commit d2aef0b8ad
1 changed files with 17 additions and 0 deletions

17
api_test.py Normal file
View File

@ -0,0 +1,17 @@
import unittest
from httpx import AsyncClient
class TestGenerateChat(unittest.IsolatedAsyncioTestCase):
async def test_generate_chat(self):
async with AsyncClient() as ac:
response = await ac.post(
"http://localhost:8000/",
json={
"prompt": "你好",
"history": [],
"max_length": 2048,
"top_p": 0.7,
"temperature": 0.95
})
self.assertEqual(response.status_code, 200)
print(response.json())