revisione, analista: taglio Telegram sul testo grezzo, prima di escape/markup (#35 C13)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -132,6 +132,18 @@ def test_telegram_porta_la_sintesi_e_dichiara_il_taglio():
|
||||
assert "[… sintesi tagliata" in lunga and len(lunga) < 4096
|
||||
|
||||
|
||||
def test_taglio_a_cavallo_di_una_entita_resta_HTML_valido():
|
||||
"""(#35 C13) Un '&' esattamente al taglio non deve spezzarsi in un'entita' a meta' (es.
|
||||
'&am'): il taglio e' sul GREZZO, prima di html.escape, quindi il carattere e' incluso o
|
||||
escluso per intero — mai spezzato a meta' entita'."""
|
||||
sintesi = "a" * (R.LIMITE_TELEGRAM - 1) + "&resto che verra' tagliato via di sicuro"
|
||||
tg = R.per_telegram(_revisione(sintesi=sintesi), None, "ok", ADESSO, Path("p.md"))
|
||||
assert "[… sintesi tagliata" in tg
|
||||
corpo = tg.split("\n\n", 1)[1].split("\n[…", 1)[0]
|
||||
assert corpo == "a" * (R.LIMITE_TELEGRAM - 1) + "&" # il '&' e' incluso PER INTERO
|
||||
assert "&am;" not in tg and "resto che verra'" not in tg # niente entita' a meta', niente coda
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- orchestrazione: cosa scrive, cosa no
|
||||
|
||||
def _albero(root: Path) -> set[str]:
|
||||
|
||||
Reference in New Issue
Block a user