Extract caption naturalizer policy
This commit is contained in:
@@ -24,6 +24,7 @@ if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
import caption_naturalizer # noqa: E402
|
||||
import caption_policy # noqa: E402
|
||||
import character_config # noqa: E402
|
||||
import character_profile # noqa: E402
|
||||
import category_cast_config # noqa: E402
|
||||
@@ -951,6 +952,47 @@ def smoke_formatter_cast_policy() -> None:
|
||||
)
|
||||
|
||||
|
||||
def smoke_caption_policy() -> None:
|
||||
_expect(
|
||||
caption_naturalizer.STYLE_TAILS is caption_policy.STYLE_TAILS,
|
||||
"Caption naturalizer style tails should delegate to caption_policy",
|
||||
)
|
||||
_expect(
|
||||
caption_naturalizer.ITEM_LABELS is caption_policy.ITEM_LABELS,
|
||||
"Caption naturalizer item labels should delegate to caption_policy",
|
||||
)
|
||||
_expect(
|
||||
caption_naturalizer.ACTION_FAMILY_CAPTION_LABELS is caption_policy.ACTION_FAMILY_CAPTION_LABELS,
|
||||
"Caption naturalizer action labels should delegate to caption_policy",
|
||||
)
|
||||
_expect(caption_policy.normalize_detail_level("bad") == "balanced", "Caption invalid detail fallback changed")
|
||||
_expect(caption_policy.keep_style_terms("keep_style_terms") is True, "Caption style policy keep flag changed")
|
||||
_expect(caption_policy.detail_allows("concise") is False, "Caption concise detail gate changed")
|
||||
_expect(caption_policy.detail_allows("dense", dense_only=True) is True, "Caption dense-only gate changed")
|
||||
|
||||
style_tail = caption_policy.STYLE_TAILS[0]
|
||||
_expect(
|
||||
caption_policy.strip_style_tail(f"caption body{style_tail}") == "caption body",
|
||||
"Caption style-tail stripping changed",
|
||||
)
|
||||
_expect(
|
||||
caption_naturalizer._strip_style_tail(f"caption body{style_tail}") == "caption body",
|
||||
"Caption naturalizer style-tail wrapper should delegate",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.normalize_composition("vertical centered body frame") == "centered body frame",
|
||||
"Caption composition normalization changed",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.clean_clothing("silk dress, fashion editorial styling") == "silk dress",
|
||||
"Caption clothing cleanup changed",
|
||||
)
|
||||
row = {"action_family": "oral", "position_family": ""}
|
||||
_expect(caption_policy.metadata_action_label(row) == "oral action", "Caption action-family label changed")
|
||||
row = {"action_family": "oral", "position_family": "anal"}
|
||||
_expect(caption_naturalizer._metadata_action_label(row) == "anal action", "Caption position-family label priority changed")
|
||||
|
||||
|
||||
def smoke_sdxl_presets_policy() -> None:
|
||||
_expect(
|
||||
sdxl_formatter.SDXL_STYLE_PRESETS is sdxl_presets.SDXL_STYLE_PRESETS,
|
||||
@@ -2964,6 +3006,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("row_normalization_policy", smoke_row_normalization_policy),
|
||||
("formatter_input_policy", smoke_formatter_input_policy),
|
||||
("formatter_cast_policy", smoke_formatter_cast_policy),
|
||||
("caption_policy", smoke_caption_policy),
|
||||
("sdxl_presets_policy", smoke_sdxl_presets_policy),
|
||||
("hardcore_position_config_policy", smoke_hardcore_position_config_policy),
|
||||
("category_library_route", smoke_category_library_route),
|
||||
|
||||
Reference in New Issue
Block a user