Extract category extension policy
This commit is contained in:
@@ -27,6 +27,7 @@ if str(ROOT) not in sys.path:
|
||||
import caption_naturalizer # noqa: E402
|
||||
import caption_policy # noqa: E402
|
||||
import cast_context # noqa: E402
|
||||
import category_extensions # noqa: E402
|
||||
import category_template_metadata # noqa: E402
|
||||
import character_appearance # noqa: E402
|
||||
import character_config # noqa: E402
|
||||
@@ -882,6 +883,29 @@ def smoke_row_generation_policy() -> None:
|
||||
)
|
||||
|
||||
|
||||
def smoke_category_extensions_policy() -> None:
|
||||
_expect(pb.BUILTIN_CATEGORIES is category_extensions.BUILTIN_CATEGORIES, "Prompt builder built-in categories should come from category_extensions")
|
||||
targets = category_extensions.extension_targets()
|
||||
_expect(
|
||||
pb._extension_targets().keys() == targets.keys(),
|
||||
"Prompt builder extension targets should delegate to category_extensions",
|
||||
)
|
||||
_expect(targets.get("group_scenes", (None, None))[1] is True, "Group scene extension target should expect scene pairs")
|
||||
sample = [{"slug": "a", "prompt": "one"}]
|
||||
category_extensions.unique_extend(sample, [{"slug": "a", "prompt": "one"}, {"slug": "b", "prompt": "two"}])
|
||||
_expect(len(sample) == 2 and sample[1]["slug"] == "b", "Category extension unique_extend changed")
|
||||
|
||||
pb.apply_pool_extensions()
|
||||
category_extensions.apply_pool_extensions()
|
||||
_expect(pb.category_choices() == category_extensions.category_choices(), "Prompt builder category choices should delegate")
|
||||
_expect(pb.subcategory_choices() == category_extensions.subcategory_choices(), "Prompt builder subcategory choices should delegate")
|
||||
_expect("Hardcore sexual poses" in pb.category_choices(), "Category choices lost hardcore JSON category")
|
||||
_expect(
|
||||
any(slug == "private_suite_group_party" for slug, _prompt in targets["group_scenes"][0]),
|
||||
"JSON pool_extensions did not reach legacy group scenes",
|
||||
)
|
||||
|
||||
|
||||
def smoke_category_cast_config_policy() -> None:
|
||||
_expect(pb.CATEGORY_PRESETS is category_cast_config.CATEGORY_PRESETS, "Prompt builder category presets are not delegated")
|
||||
_expect(pb.CAST_PRESETS is category_cast_config.CAST_PRESETS, "Prompt builder cast presets are not delegated")
|
||||
@@ -4083,6 +4107,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("row_expression_policy", smoke_row_expression_policy),
|
||||
("row_item_policy", smoke_row_item_policy),
|
||||
("row_generation_policy", smoke_row_generation_policy),
|
||||
("category_extensions_policy", smoke_category_extensions_policy),
|
||||
("category_cast_config_policy", smoke_category_cast_config_policy),
|
||||
("generation_profile_config_policy", smoke_generation_profile_config_policy),
|
||||
("filter_config_policy", smoke_filter_config_policy),
|
||||
|
||||
Reference in New Issue
Block a user