aboutsummaryrefslogtreecommitdiff
path: root/tests/test_generate.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_generate.py')
-rw-r--r--tests/test_generate.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_generate.py b/tests/test_generate.py
index 8eaf44b..0bb0b5e 100644
--- a/tests/test_generate.py
+++ b/tests/test_generate.py
@@ -129,3 +129,26 @@ async def test_stalled_backend_still_queued_keeps_waiting(
await comfy.release()
result, _ = await asyncio.wait_for(task, timeout=5)
assert result["status"] == "success"
+
+
+async def test_steps_requested_and_default(
+ make_tools: Callable[[], Any], comfy: FakeComfy
+) -> None:
+ tools, _ = make_tools()
+ result, _ = await _run(tools, steps=12)
+ assert comfy.submitted[0]["459:458"]["inputs"]["steps"] == 12
+ assert result["steps"] == 12
+
+ result, _ = await _run(tools) # falls back to the global setting (FakeEnv: 25)
+ assert comfy.submitted[1]["459:458"]["inputs"]["steps"] == 25
+ assert result["steps"] == 25
+
+
+@pytest.mark.parametrize("steps", [0, -3, 101])
+async def test_steps_out_of_range_rejected(
+ make_tools: Callable[[], Any], comfy: FakeComfy, steps: int
+) -> None:
+ tools, _ = make_tools()
+ with pytest.raises(ValueError, match="between 1 and 100"):
+ await _run(tools, steps=steps)
+ assert not comfy.submitted