diff --git a/bin/do_epic/config.py b/bin/do_epic/config.py index 85845070..a53ec91e 100644 --- a/bin/do_epic/config.py +++ b/bin/do_epic/config.py @@ -86,14 +86,14 @@ def label_repo_faults(table: object) -> list[str]: def summary_template_faults(template: object) -> list[str]: - """What is wrong with the SUB_TASK_SUMMARY template: a value that isn't one line, that holds a brace Python can't read, a field other than `{label}` and `{Summary}`, a format after a field's name, or no `{Summary}`.""" + """What is wrong with the SUB_TASK_SUMMARY template: a value that isn't one line, that Python can't read as a template, a field other than `{label}` and `{Summary}`, a format after a field's name, or no `{Summary}`.""" example = "`\"{label}: {Summary}\"`" if not isinstance(template, str) or "\n" in template: return [f"`{SUB_TASK_SUMMARY}` is {template!r}, not one line of text such as {example}"] try: fields = [(name, spec, conversion) for _, name, spec, conversion in string.Formatter().parse(template) if name is not None] - except ValueError: - return [f"`{SUB_TASK_SUMMARY}` is {template!r}, which has a brace that stands alone; write a brace that is plain text as {{{{ or }}}}"] + except ValueError as failure: + return [f"`{SUB_TASK_SUMMARY}` is {template!r}, which Python can't read as a template ({failure}); write a brace that is plain text as {{{{ or }}}}"] names = [name for name, _, _ in fields] return [ *(f"`{SUB_TASK_SUMMARY}` names {{{name}}}, and only {{label}} and {{Summary}} are known" for name in dict.fromkeys(names) if name not in ("label", "Summary")), diff --git a/bin/do_epic/test_do_epic.py b/bin/do_epic/test_do_epic.py index 3d9fc166..4aa33c64 100644 --- a/bin/do_epic/test_do_epic.py +++ b/bin/do_epic/test_do_epic.py @@ -76,11 +76,12 @@ class ConfigTest(unittest.TestCase): for line, fault in ( ("sub-task-summary = 4", "`sub-task-summary` is 4, not one line of text"), ('sub-task-summary = "a\\nb {Summary}"', "not one line of text"), - ('sub-task-summary = "{label}"', "`sub-task-summary` lacks {Summary}, so no sub-task's summary would say what changes in it, such as `\"{label}: {Summary}\"`"), - ('sub-task-summary = "{label}: {Summary} {repo}"', "`sub-task-summary` names {repo}, and only {label} and {Summary} are known"), - ('sub-task-summary = "{Summary:>9}"', "`sub-task-summary` writes {Summary:>9} with something after the name; write {Summary} alone"), - ('sub-task-summary = "{Summary} {label!r}"', "`sub-task-summary` writes {label!r} with something after the name; write {label} alone"), - ('sub-task-summary = "{Summary"', "`sub-task-summary` is '{Summary', which has a brace that stands alone; write a brace that is plain text as {{ or }}"), + ('sub-task-summary = "{label}"', "`sub-task-summary` lacks {Summary}"), + ('sub-task-summary = "{label}: {Summary} {repo}"', "names {repo}, and only {label} and {Summary} are known"), + ('sub-task-summary = "{Summary:>9}"', "writes {Summary:>9} with something after the name; write {Summary} alone"), + ('sub-task-summary = "{Summary} {label!r}"', "writes {label!r} with something after the name; write {label} alone"), + ('sub-task-summary = "{Summary!}"', "`sub-task-summary` is '{Summary!}', which Python can't read as a template ("), + ('sub-task-summary = "{Summary"', "`sub-task-summary` is '{Summary', which Python can't read as a template ("), ): with self.subTest(line=line): self.write(SETTINGS + line + "\n") diff --git a/bin/do_epic/test_planning.py b/bin/do_epic/test_planning.py index 7c4c5c24..24f32b77 100644 --- a/bin/do_epic/test_planning.py +++ b/bin/do_epic/test_planning.py @@ -189,7 +189,7 @@ class Planning(DoEpicTest): fake = FakeEffects(claude=[says({"parts": []}), says({"pick": "unclear", "question": "api or web?"})], inputs=["api", "backend"]) found, _, _ = self.plan(fake) self.assertEqual(found, [issue("ABC-20", "backend")]) - self.assertIn("`api` is none of those labels; the repo api's label is `backend`\n", self.asked.getvalue()) + self.assertIn("the repo api's label is `backend`", self.asked.getvalue()) def test_asks_the_human_for_the_label_of_an_issue_the_rule_leaves_unclear_until_one_is_typed(self) -> None: self.issues = [issue("ABC-20")]