add asyn sd ut

This commit is contained in:
stellahsr 2024-01-11 22:43:02 +08:00
parent 3be26cf94f
commit 12bc0104b6
2 changed files with 31 additions and 29 deletions

View file

@ -2,16 +2,29 @@
# @Date : 1/10/2024 10:07 PM
# @Author : stellahong (stellahong@fuzhi.ai)
# @Desc :
import pytest
from metagpt.tools.sd_engine import SDEngine
def test_sd_tools():
engine = SDEngine()
prompt = "1boy, hansom"
engine.construct_payload(prompt)
engine.simple_run_t2i(engine.payload)
def test_sd_construct_payload():
engine = SDEngine()
prompt = "1boy, hansom"
engine.construct_payload(prompt)
assert "negative_prompt" in engine.payload
assert "negative_prompt" in engine.payload
@pytest.mark.asyncio
async def test_sd_asyn_t2i():
engine = SDEngine()
prompt = "1boy, hansom"
engine.construct_payload(prompt)
await engine.run_t2i([engine.payload])
assert "negative_prompt" in engine.payload