Extract character appearance policy

This commit is contained in:
2026-06-27 08:37:04 +02:00
parent e9cc75bd5f
commit 70a8698cbe
5 changed files with 326 additions and 195 deletions
+18
View File
@@ -28,6 +28,7 @@ import caption_naturalizer # noqa: E402
import caption_policy # noqa: E402
import cast_context # noqa: E402
import category_template_metadata # noqa: E402
import character_appearance # noqa: E402
import character_config # noqa: E402
import character_profile # noqa: E402
import character_slot # noqa: E402
@@ -935,6 +936,23 @@ def smoke_character_config_policy() -> None:
== character_slot.slot_effective_figure({"slot_seed": 123, "figure": "random"}, "woman", "curvy"),
"Prompt builder seeded slot figure should delegate to character_slot",
)
_expect(
pb._appearance_for_subject(random.Random(9), "woman", "western_european", "balanced", False, False)
== character_appearance.appearance_for_subject(random.Random(9), "woman", "western_european", "balanced", False, False),
"Prompt builder appearance selection should delegate to character_appearance",
)
_expect(
pb._context_from_character_slot(random.Random(11), slot, "man", "any", "curvy", False, False)
== character_appearance.context_from_character_slot(random.Random(11), slot, "man", "any", "curvy", False, False),
"Prompt builder slot context should delegate to character_appearance",
)
_expect(
pb._row_from_character_slot(slot_result["character_slot"])
== character_appearance.row_from_character_slot(slot_result["character_slot"]),
"Prompt builder slot row conversion should delegate to character_appearance",
)
row = character_appearance.apply_character_context_to_row({}, {"age": "44-year-old adult", "body": "stocky"})
_expect(row.get("age_band") == "44-year-old adult" and row.get("body") == "stocky", "Character context row application changed")
def smoke_character_profile_policy() -> None: