mirror of https://github.com/THUDM/ChatGLM-6B
添加单元测试
parent
14f73a2efe
commit
d2aef0b8ad
|
@ -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())
|
Loading…
Reference in New Issue