Answer stability round 1: 0 🔴, 4 🟡 (0 misread); name each template fault truly and pass the template to split
CI / tests (pull_request) Successful in 2m33s
CI / tests (pull_request) Successful in 2m33s
This commit is contained in:
+18
-16
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -67,12 +66,6 @@ class ConfigTest(unittest.TestCase):
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual(found.sub_task_summary, "{label}: {Summary}")
|
||||
|
||||
def test_reads_a_template_that_ends_in_plain_text(self) -> None:
|
||||
self.write(SETTINGS + 'sub-task-summary = "{Summary} for {label} in Jira"\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual(found.sub_task_summary, "{Summary} for {label} in Jira")
|
||||
|
||||
def test_leaves_a_sub_tasks_summary_to_its_default_where_the_config_has_no_template(self) -> None:
|
||||
self.write()
|
||||
found = load(self.home)
|
||||
@@ -80,18 +73,27 @@ class ConfigTest(unittest.TestCase):
|
||||
self.assertIsNone(found.sub_task_summary)
|
||||
|
||||
def test_refuses_a_template_that_is_no_one_line_with_summary_and_only_known_fields(self) -> None:
|
||||
for template, fault in (
|
||||
("4", "`sub-task-summary` is 4, not one line of text"),
|
||||
("a\\nb {Summary}", "not one line of text"),
|
||||
("{label}", "`sub-task-summary` lacks {Summary}, so every sub-task would get the same summary, such as `\"{label}: {Summary}\"`"),
|
||||
("{label}: {Summary} {repo}", "`sub-task-summary` names {repo}, and only {label} and {Summary} are known"),
|
||||
("{Summary:>9}", "`sub-task-summary` holds a field with a format or conversion"),
|
||||
("{Summary", "`sub-task-summary` is '{Summary'"),
|
||||
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 }}"),
|
||||
):
|
||||
with self.subTest(template=template):
|
||||
self.write(SETTINGS + f"sub-task-summary = {template if template == '4' else json.dumps(template.replace(chr(92) + 'n', chr(10)))}\n")
|
||||
with self.subTest(line=line):
|
||||
self.write(SETTINGS + line + "\n")
|
||||
self.assertIn(fault, self.failure())
|
||||
|
||||
def test_reads_a_template_of_plain_text_around_its_fields_and_a_brace_written_twice(self) -> None:
|
||||
for template in ("{Summary}", "{Summary}{{", "{Summary} for {label} in Jira"):
|
||||
with self.subTest(template=template):
|
||||
self.write(SETTINGS + f'sub-task-summary = "{template}"\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual(found.sub_task_summary, template)
|
||||
|
||||
def test_refuses_a_label_repos_that_is_no_table(self) -> None:
|
||||
self.write('label-repos = "twu-4"\n' + SETTINGS)
|
||||
self.assertIn("`label-repos` is 'twu-4', not a table of labels, such as `twu-4 = \"tenant-web-ui-4\"` under `[label-repos]`", self.failure())
|
||||
|
||||
Reference in New Issue
Block a user