Extract SDXL preset policy
This commit is contained in:
@@ -38,6 +38,7 @@ import location_config # noqa: E402
|
||||
import prompt_builder as pb # noqa: E402
|
||||
import row_normalization # noqa: E402
|
||||
import sdxl_formatter # noqa: E402
|
||||
import sdxl_presets # noqa: E402
|
||||
import seed_config # noqa: E402
|
||||
|
||||
|
||||
@@ -899,6 +900,46 @@ def smoke_formatter_input_policy() -> None:
|
||||
_expect_text("formatter_input.caption", caption, 20)
|
||||
|
||||
|
||||
def smoke_sdxl_presets_policy() -> None:
|
||||
_expect(
|
||||
sdxl_formatter.SDXL_STYLE_PRESETS is sdxl_presets.SDXL_STYLE_PRESETS,
|
||||
"SDXL formatter style presets should delegate to sdxl_presets",
|
||||
)
|
||||
_expect(
|
||||
sdxl_formatter.SDXL_QUALITY_PRESETS is sdxl_presets.SDXL_QUALITY_PRESETS,
|
||||
"SDXL formatter quality presets should delegate to sdxl_presets",
|
||||
)
|
||||
_expect(
|
||||
sdxl_formatter.SDXL_ACTION_FAMILY_TAGS is sdxl_presets.SDXL_ACTION_FAMILY_TAGS,
|
||||
"SDXL formatter action-family tags should delegate to sdxl_presets",
|
||||
)
|
||||
_expect("flat_vector_pony" in sdxl_presets.sdxl_style_preset_choices(), "SDXL style preset choices lost default")
|
||||
_expect("pony_high" in sdxl_presets.sdxl_quality_preset_choices(), "SDXL quality preset choices lost default")
|
||||
_expect(sdxl_presets.normalize_style_preset("bad") == sdxl_presets.DEFAULT_STYLE_PRESET, "SDXL invalid style fallback changed")
|
||||
_expect(sdxl_presets.normalize_quality_preset("bad") == sdxl_presets.DEFAULT_QUALITY_PRESET, "SDXL invalid quality fallback changed")
|
||||
|
||||
row = _fixture_hardcore_row(
|
||||
action_family="oral",
|
||||
position_family="oral",
|
||||
position_key="kneeling_oral",
|
||||
position_keys=["kneeling_oral"],
|
||||
)
|
||||
tags = sdxl_formatter._metadata_family_tags(row)
|
||||
_expect("oral sex" in tags, "SDXL metadata family tags lost oral family tag")
|
||||
_expect("kneeling oral" in tags, "SDXL metadata family tags lost position key tag")
|
||||
formatted = sdxl_formatter.format_sdxl_prompt(
|
||||
_json(row),
|
||||
input_hint="auto",
|
||||
style_preset="bad",
|
||||
quality_preset="bad",
|
||||
trigger=SdxlTrigger,
|
||||
prepend_trigger=True,
|
||||
)
|
||||
_expect_trigger_once("sdxl_presets.formatted_prompt", formatted.get("sdxl_prompt"), SdxlTrigger)
|
||||
_expect("Flat vector" in formatted.get("sdxl_prompt", ""), "SDXL invalid style did not fall back to default preset")
|
||||
_expect("score_9" in formatted.get("sdxl_prompt", ""), "SDXL invalid quality did not fall back to default preset")
|
||||
|
||||
|
||||
def smoke_hardcore_position_config_policy() -> None:
|
||||
_expect(
|
||||
pb.HARDCORE_POSITION_FAMILY_CHOICES is hardcore_position_config.HARDCORE_POSITION_FAMILY_CHOICES,
|
||||
@@ -2871,6 +2912,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("character_profile_policy", smoke_character_profile_policy),
|
||||
("row_normalization_policy", smoke_row_normalization_policy),
|
||||
("formatter_input_policy", smoke_formatter_input_policy),
|
||||
("sdxl_presets_policy", smoke_sdxl_presets_policy),
|
||||
("hardcore_position_config_policy", smoke_hardcore_position_config_policy),
|
||||
("category_library_route", smoke_category_library_route),
|
||||
("hardcore_category_routes", smoke_hardcore_category_routes),
|
||||
|
||||
Reference in New Issue
Block a user