diff --git a/bin/branch_chunks/test_branch_chunks.py b/bin/branch_chunks/test_branch_chunks.py index 4d37beeb..e3ddef26 100644 --- a/bin/branch_chunks/test_branch_chunks.py +++ b/bin/branch_chunks/test_branch_chunks.py @@ -255,10 +255,10 @@ class BranchChunks(unittest.TestCase): self.env.pop(name) return self.git("rev-parse", "--short", "HEAD").strip() - def read(self, run=None): + def read(self, run=None, **template): """branch_chunks over main, run by git_repo's git, or else by run.""" with unittest.mock.patch.dict(os.environ, self.env, clear=True): - return branch_chunks("main", functools.partial(run or git, cwd=str(self.checkout))) + return branch_chunks("main", functools.partial(run or git, cwd=str(self.checkout)), **template) def fixing_history(self): """Merges seven chunks onto main, then checks out a branch off it. Returns each of main's chunks by label, with the chunks that fixed it. @@ -316,6 +316,13 @@ class BranchChunks(unittest.TestCase): self.assertNotIsInstance(found, Failure) self.assertEqual([([item.id for item in found.shipped], found.fixed_by) for found in found[:2]], [([], ()), ([4], ())]) + def test_reads_a_drop_title_through_the_projects_commit_title(self): + self.merge("four", "Do four", {"b.py": "x\ny\n", "todo.md": todo(SECOND, FIX)}, "2026-10-13T10:00:00Z") + self.merge("six", "PAY-6 Drop item 6: item 4 fixed it", {"b.py": "x\nY\n", "todo.md": todo(SECOND)}, "2026-10-14T10:00:00Z") + found = self.read(template="PAY-{id} {summary}") + self.assertNotIsInstance(found, Failure) + self.assertEqual([[item.id for item in found.shipped] for found in found[:2]], [[], [4]]) + def test_fails_where_git_cannot_read_the_branch(self): self.assertEqual(branch_chunks("main", lambda *args: Failure("no log")), Failure("no log")) diff --git a/bin/project_config/test_templates.py b/bin/project_config/test_templates.py index 780b4d74..00329457 100644 --- a/bin/project_config/test_templates.py +++ b/bin/project_config/test_templates.py @@ -19,7 +19,7 @@ class TitleTest(unittest.TestCase): for template in ("item-{id}", "feature/PAY-{id}", "{id}"): with self.subTest(template): self.assertIsNone(branch_fault(template)) - for template in ("feature", "{id}-{summary}", "{id}/{id}", "feature/ PAY-{id}", "-{id}", "a..b{id}", "{id}.lock", "/{id}", "{id}/", "a~{id}", 3): + for template in ("feature", "{id}-{summary}", "{id}/{id}", "feature/ PAY-{id}", "-{id}", "a..b{id}", "{id}.lock", "/{id}", "{id}/", "a~{id}", ".hidden/{id}", "{id}.", 3): with self.subTest(template): self.assertIsNotNone(branch_fault(template))