Centralize formatter target policy
This commit is contained in:
@@ -42,6 +42,7 @@ import category_cast_config # noqa: E402
|
||||
import category_library # noqa: E402
|
||||
import filter_config # noqa: E402
|
||||
import formatter_input # noqa: E402
|
||||
import formatter_target # noqa: E402
|
||||
import hardcore_position_config # noqa: E402
|
||||
import __init__ as sxcp_nodes # noqa: E402
|
||||
import generation_profile_config # noqa: E402
|
||||
@@ -2759,6 +2760,31 @@ def smoke_formatter_input_policy() -> None:
|
||||
_expect("blur" in fallback_sdxl.get("negative_prompt", ""), "SDXL fallback lost Avoid negative text")
|
||||
|
||||
|
||||
def smoke_formatter_target_policy() -> None:
|
||||
_expect(formatter_target.normalize_target("single") == "single", "Formatter target lost single")
|
||||
_expect(formatter_target.normalize_target("Hard-Core") == "hardcore", "Formatter target alias lost hardcore")
|
||||
_expect(formatter_target.normalize_target("soft") == "softcore", "Formatter target alias lost softcore")
|
||||
_expect(formatter_target.normalize_target("bad target") == "auto", "Formatter target should normalize invalid values")
|
||||
|
||||
auto_pair = formatter_target.pair_policy("auto")
|
||||
_expect(auto_pair.target == "auto", "Pair target policy lost normalized auto target")
|
||||
_expect(auto_pair.pair_target == "auto", "Pair target policy lost auto pair target")
|
||||
_expect(auto_pair.selected_side == "softcore", "Pair auto should select softcore side for single-output formatters")
|
||||
_expect(auto_pair.include_softcore and auto_pair.include_hardcore, "Pair auto should include both sides for combined captions")
|
||||
|
||||
single_pair = formatter_target.pair_policy("single")
|
||||
_expect(single_pair.target == "single", "Pair target policy lost normalized single target")
|
||||
_expect(single_pair.pair_target == "auto", "Pair single should map to auto for pair inclusion")
|
||||
_expect(single_pair.selected_side == "softcore", "Pair single should select softcore side by default")
|
||||
_expect(single_pair.include_softcore and single_pair.include_hardcore, "Pair single should include both sides when treated as auto")
|
||||
|
||||
hard_pair = formatter_target.pair_policy("hard")
|
||||
_expect(hard_pair.target == "hardcore", "Pair target policy lost hard alias")
|
||||
_expect(hard_pair.pair_target == "hardcore", "Pair hard alias should become hardcore pair target")
|
||||
_expect(hard_pair.selected_side == "hardcore", "Pair hardcore should select hardcore side")
|
||||
_expect(not hard_pair.include_softcore and hard_pair.include_hardcore, "Pair hardcore should include only hard side")
|
||||
|
||||
|
||||
def smoke_krea_format_route_policy() -> None:
|
||||
row = _prompt_row(
|
||||
name="krea_format_route_single",
|
||||
@@ -6557,6 +6583,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("row_role_graph_policy", smoke_row_role_graph_policy),
|
||||
("row_assembly_policy", smoke_row_assembly_policy),
|
||||
("formatter_input_policy", smoke_formatter_input_policy),
|
||||
("formatter_target_policy", smoke_formatter_target_policy),
|
||||
("krea_format_route_policy", smoke_krea_format_route_policy),
|
||||
("formatter_cast_policy", smoke_formatter_cast_policy),
|
||||
("caption_policy", smoke_caption_policy),
|
||||
|
||||
Reference in New Issue
Block a user