Extract location config policy
This commit is contained in:
@@ -27,6 +27,7 @@ import caption_naturalizer # noqa: E402
|
||||
import category_library # noqa: E402
|
||||
import __init__ as sxcp_nodes # noqa: E402
|
||||
import krea_formatter # noqa: E402
|
||||
import location_config # noqa: E402
|
||||
import prompt_builder as pb # noqa: E402
|
||||
import sdxl_formatter # noqa: E402
|
||||
import seed_config # noqa: E402
|
||||
@@ -498,6 +499,61 @@ def smoke_config_route_location_theme() -> None:
|
||||
_expect_formatter_outputs(row, "config_route_location_theme", target="single")
|
||||
|
||||
|
||||
def smoke_location_config_policy() -> None:
|
||||
_expect(pb.LOCATION_POOL_PRESETS is location_config.LOCATION_POOL_PRESETS, "Prompt builder location presets are not delegated")
|
||||
_expect(pb.COMPOSITION_POOL_PRESETS is location_config.COMPOSITION_POOL_PRESETS, "Prompt builder composition presets are not delegated")
|
||||
_expect("classical_library" in location_config.location_theme_choices(), "Location themes lost classical_library")
|
||||
|
||||
custom = json.loads(
|
||||
pb.build_location_pool_json(
|
||||
enabled=True,
|
||||
combine_mode="replace",
|
||||
preset="custom_only",
|
||||
custom_locations="custom_room: a quiet room with warm lamps",
|
||||
)
|
||||
)
|
||||
_expect(custom.get("enabled") is True, "Custom location config should be active")
|
||||
_expect(custom.get("apply_mode") == "replace", "Custom location config lost replace mode")
|
||||
_expect(custom.get("scene_entries", [{}])[0].get("slug") == "custom_room", "Custom location slug parser changed")
|
||||
|
||||
added = json.loads(
|
||||
location_config.build_location_pool_json(
|
||||
enabled=True,
|
||||
combine_mode="add",
|
||||
preset="custom_only",
|
||||
custom_locations="second_room: another quiet room",
|
||||
location_config=custom,
|
||||
)
|
||||
)
|
||||
_expect(added.get("apply_mode") == "replace", "Location add merge should preserve incoming apply_mode")
|
||||
_expect(len(added.get("scene_entries") or []) == 2, "Location add merge did not keep both custom locations")
|
||||
|
||||
composition = json.loads(
|
||||
pb.build_composition_pool_json(
|
||||
enabled=True,
|
||||
combine_mode="replace",
|
||||
preset="no_outfit_check",
|
||||
custom_compositions="manual frame through foreground bookshelves",
|
||||
)
|
||||
)
|
||||
_expect(composition.get("enabled") is True, "Composition config should be active")
|
||||
_expect(
|
||||
any("outfit-check" in str(entry) for entry in composition.get("composition_entries") or []),
|
||||
"Composition inline preset no_outfit_check was not applied",
|
||||
)
|
||||
parsed = pb._parse_location_config({"enabled": True, "pool_names": [], "scene_entries": custom["scene_entries"]})
|
||||
_expect(pb._location_config_active(parsed), "Prompt builder location parser wrapper is inactive")
|
||||
|
||||
themed_location, themed_composition, theme_summary = pb.build_thematic_location_json(
|
||||
enabled=True,
|
||||
combine_mode="replace",
|
||||
theme="classical_library",
|
||||
)
|
||||
_expect("classical_library" in theme_summary, "Themed location summary lost theme name")
|
||||
_expect(json.loads(themed_location).get("scene_entries"), "Themed location did not output locations")
|
||||
_expect(json.loads(themed_composition).get("composition_entries"), "Themed location did not output compositions")
|
||||
|
||||
|
||||
def smoke_category_library_route() -> None:
|
||||
categories = category_library.load_category_library()
|
||||
_expect(len(categories) >= 3, "category library should load JSON categories")
|
||||
@@ -2404,6 +2460,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("builtin_single_woman", smoke_builtin_single),
|
||||
("camera_scene_single", smoke_camera_scene_single),
|
||||
("config_route_location_theme", smoke_config_route_location_theme),
|
||||
("location_config_policy", smoke_location_config_policy),
|
||||
("category_library_route", smoke_category_library_route),
|
||||
("hardcore_category_routes", smoke_hardcore_category_routes),
|
||||
("krea_close_foreplay_route", smoke_krea_close_foreplay_route),
|
||||
|
||||
Reference in New Issue
Block a user