Extract cast context policy
This commit is contained in:
@@ -26,6 +26,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_template_metadata # noqa: E402
|
||||
import character_config # noqa: E402
|
||||
import character_profile # noqa: E402
|
||||
@@ -658,6 +659,29 @@ def smoke_category_cast_config_policy() -> None:
|
||||
_expect(pb.CAST_PRESETS is category_cast_config.CAST_PRESETS, "Prompt builder cast presets are not delegated")
|
||||
_expect("hardcore_pose" in category_cast_config.category_preset_choices(), "Category preset choices lost hardcore_pose")
|
||||
_expect("custom_counts" in category_cast_config.cast_preset_choices(), "Cast preset choices lost custom_counts")
|
||||
_expect(
|
||||
pb._count_phrase(2, "adult woman", "adult women") == cast_context.count_phrase(2, "adult woman", "adult women"),
|
||||
"Prompt builder count phrase should delegate to cast_context",
|
||||
)
|
||||
configured = cast_context.configured_cast_context(1, 2)
|
||||
_expect(configured.get("subject_phrase") == "one adult woman and two adult men", "Configured cast subject phrase changed")
|
||||
_expect(configured.get("cast_summary") == "1 woman, 2 men, 3 total adults", "Configured cast summary changed")
|
||||
_expect(configured.get("scene_kind") == "adult threesome sex scene", "Configured cast scene kind changed")
|
||||
_expect(
|
||||
pb._configured_cast_context(1, 2) == configured,
|
||||
"Prompt builder configured cast context should delegate to cast_context",
|
||||
)
|
||||
_expect(
|
||||
cast_context.couple_type_from_counts(
|
||||
random.Random(1),
|
||||
2,
|
||||
0,
|
||||
choose=lambda _rng, pool: pool[0],
|
||||
couple_types=[("woman and man", "a woman and a man", "fallback pose")],
|
||||
)
|
||||
== ("two women", "two women", "close affectionate couple pose", 2, 0),
|
||||
"Couple type count override for two women changed",
|
||||
)
|
||||
|
||||
category_config = json.loads(pb.build_category_config_json("hardcore_pose", "Foreplay and teasing"))
|
||||
_expect(category_config.get("category") == "Hardcore sexual poses", "Category config lost hardcore category mapping")
|
||||
|
||||
Reference in New Issue
Block a user