Spaces:
Running
Running
| from poetic.textfree import FULL_BLEED_PAINTING_RULE, TEXT_FREE_RULE, ensure_text_free | |
| def test_appends_canonical_no_text_rule_when_brief_omits_it(): | |
| out = ensure_text_free("A misty river at dawn.") | |
| assert out.startswith("A misty river at dawn.") | |
| assert TEXT_FREE_RULE in out | |
| def test_appends_full_bleed_rule_when_brief_omits_it(): | |
| out = ensure_text_free("A lotus pond in a classical Chinese painting style.") | |
| assert FULL_BLEED_PAINTING_RULE in out | |
| assert "full-bleed 3:4 portrait painting" in out | |
| assert "no black bands" in out | |
| assert "no split panels" in out | |
| def test_does_not_duplicate_text_free_rule(): | |
| out = ensure_text_free(f"A quiet lake. {TEXT_FREE_RULE}") | |
| assert out.count(TEXT_FREE_RULE) == 1 | |
| def test_does_not_duplicate_full_bleed_rule(): | |
| out = ensure_text_free(f"A quiet lake. {FULL_BLEED_PAINTING_RULE}") | |
| assert out.count(FULL_BLEED_PAINTING_RULE) == 1 | |
| def test_keeps_original_brief_intact(): | |
| assert "Bamboo in snow" in ensure_text_free("Bamboo in snow") | |
| def test_exports_exact_safety_rule_strings(): | |
| assert TEXT_FREE_RULE == ( | |
| "a painting only — no text, no Chinese characters, no calligraphy, no seals, no watermark" | |
| ) | |
| assert FULL_BLEED_PAINTING_RULE == ( | |
| "full-bleed 3:4 portrait painting -- fill the entire canvas edge to edge; no borders," | |
| " no frame, no mat, no margins, no black bands, no poster layout, no split panels, no embedded text" | |
| ) | |