Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed May 6, 2024
1 parent 8c2b4ed commit 8845b19
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion scripts/batch_hijack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from copy import copy
from typing import Tuple, List

from modules import img2img, processing, shared, script_callbacks
Expand Down
2 changes: 1 addition & 1 deletion tests/cn_script/batch_hijack_test_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def assert_get_cn_batches_works(self, batch_images_list):
is_cn_batch, batches, output_dir, _ = batch_hijack.get_cn_batches(self.p)
batch_hijack.instance.dispatch_callbacks(batch_hijack.instance.process_batch_callbacks, self.p, batches, output_dir)

batch_units = [unit for unit in self.p.script_args if getattr(unit, 'input_mode', batch_hijack.InputMode.SIMPLE) == batch_hijack.InputMode.BATCH]
batch_units = [unit for unit in self.p.script_args if unit.get('input_mode', batch_hijack.InputMode.SIMPLE) == batch_hijack.InputMode.BATCH]
if batch_units:
self.assertEqual(min(len(list(unit.batch_images)) for unit in batch_units), len(batches))
else:
Expand Down
12 changes: 6 additions & 6 deletions tests/web_api/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ def test_detect_default_param():
dict(
controlnet_input_images=[realistic_girl_face_img],
controlnet_module="canny", # Canny does not require model download.
controlnet_threshold_a=-1,
controlnet_threshold_b=-1,
controlnet_processor_res=-1,
controlnet_threshold_a=-100,
controlnet_threshold_b=-100,
controlnet_processor_res=-100,
),
"default_param",
)
assert log_context.is_in_console_logs(
[
"[canny.processor_res] Invalid value(-1), using default value 512.",
"[canny.threshold_a] Invalid value(-1.0), using default value 100.",
"[canny.threshold_b] Invalid value(-1.0), using default value 200.",
"[canny.processor_res] Invalid value(-100), using default value 512.",
"[canny.threshold_a] Invalid value(-100.0), using default value 100.",
"[canny.threshold_b] Invalid value(-100.0), using default value 200.",
]
)
3 changes: 2 additions & 1 deletion tests/web_api/generation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ def test_invalid_param(gen_type, param_name):
unit_overrides={param_name: -100},
input_image=girl_img,
).exec()
number = "-100" if param_name == "processor_res" else "-100.0"
assert log_context.is_in_console_logs(
[
f"[canny.{param_name}] Invalid value(-100.0), using default value",
f"[canny.{param_name}] Invalid value({number}), using default value",
]
)

Expand Down

0 comments on commit 8845b19

Please sign in to comment.