Answer prose round 1: 0 🔴, 7 🟡 (0 misread); the codec pads on a space at both ends too, and the Valid lines name the event that expires them

This commit is contained in:
2026-11-17 03:51:51 +01:00
parent f56962cd8d
commit 2e44ec95ca
3 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ The spelling, which the decision `todo.md: an item of the next release predicts
A path alone is the whole file, and (small) marks a part the item changes only a little. file_parts says how a part is named.
A path or a name that holds a backtick is spelt as a Markdown code span that holds one: in a longer run of backticks than any it holds, with a space inside each end, as in `` ## The `foo` tool ``. So every path and name on one line has a spelling. A description kept in Jira reaches here through adf_codec, which spells such a name without the spaces where it neither opens nor ends in a backtick, as ``a`b.md``; that is read as the same name."""
A path or a name that holds a backtick is spelt as a Markdown code span that holds one: in a longer run of backticks than any it holds, with a space inside each end, as in `` ## The `foo` tool ``. So every path and name on one line has a spelling. A description kept in Jira reaches here through adf_codec, which pads a span only where its text opens or ends in a backtick, or opens and ends in a space. So it spells a`b.md as ``a`b.md``; code_span reads that as the name too."""
import dataclasses
import re
@@ -84,7 +84,7 @@ def code_span(line: str, at: int) -> tuple[str, int] | None:
if len(run) > 1:
if not text.strip():
return None
# As a Markdown code span reads: a space inside each end keeps a backtick at either end of the text apart from the run, and goes. adf_codec pads only that case, so no space is also the text.
# A space at both ends is padding, which keeps a backtick at either end of the text apart from the run. Without one at both ends, the span is its text.
if len(text) >= 3 and text.startswith(" ") and text.endswith(" "):
text = text[1:-1]
return (text, opened.end() + closed.end()) if text else None
@@ -135,8 +135,7 @@ class PredictedTest(unittest.TestCase):
self.assertEqual(predicted("Touches:\n- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```, `` `x` ``\n"), {"a.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))})
self.assertEqual(rendered({"a.md": (Part("## The `foo` tool", small=True), Part("``"))}), "- `a.md`: `` ## The `foo` tool `` (small), ``` `` ```")
def test_a_longer_run_without_the_spaces_the_text_does_not_need_reads_as_its_text(self) -> None:
# The spelling adf_codec gives a code mark: it pads a longer run only where the text opens or ends in a backtick.
def test_a_longer_run_without_padding_spaces_is_the_text_between_its_runs(self) -> None:
self.assertEqual(predicted("Touches:\n- ``a`b.md``: ``## The `foo` tool`` (small), ``` `` ```, `` `x` ``\n"), {"a`b.md": (Part("## The `foo` tool", small=True), Part("``"), Part("`x`"))})
def test_a_longer_run_with_a_space_at_one_end_only_keeps_it(self) -> None:
@@ -149,7 +148,7 @@ class PredictedTest(unittest.TestCase):
self.assertEqual(predicted(convert.adf_to_markdown(description)), predicted(DETAIL))
@needs_docker
def test_a_list_typed_in_jiras_editor_reads_as_the_item_it_names(self) -> None:
def test_a_list_typed_in_jiras_editor_reads_as_its_files_and_parts(self) -> None:
read = convert.adf_to_markdown(JIRA_TOUCHES)
self.assertEqual(predicted(read), {
"bin/a.py": (Part("main"), Part("Plan.branch", small=True)),
@@ -168,7 +167,7 @@ class PredictedTest(unittest.TestCase):
touches = {"my file.md": (Part("## todo.md: under `Touches:` in its detail"), Part("## ``a`` and `b`", small=True), Part("`"), Part("## ends in `x`"), Part(" x "), Part("lines 2-3")), "a`b.md": (), "c, d: e.md": (Part("# T"),)}
self.assertEqual(predicted(f"Touches:\n\n{rendered(touches)}\n"), touches)
def test_a_longer_run_without_its_end_or_a_name_is_a_failure(self) -> None:
def test_a_bullet_with_an_unclosed_run_a_blank_name_or_a_stray_separator_is_a_failure(self) -> None:
for bullet in ("- `a.md`: `` ## A", "- `a.md`: `` ## A `", "- `a.md`: `` ``", "- `a.md`: ", "- `a.md`:", "- `a.md`: `f`, ", "- `a.md`: `f`,`g`", "- ``", "- `a.md` (small)", "- `a.md`: `f` (small) (small)"):
with self.subTest(bullet):
self.assertIsInstance(predicted(f"Touches:\n\n{bullet}\n"), Failure)