diff --git a/bin/chunk_preflight/test_chunk_preflight.py b/bin/chunk_preflight/test_chunk_preflight.py index d27fd905..54c1344b 100644 --- a/bin/chunk_preflight/test_chunk_preflight.py +++ b/bin/chunk_preflight/test_chunk_preflight.py @@ -56,6 +56,8 @@ SHIPPED = TODO.replace("| 3 | 0.2.0 | | | **Do the next thing.** | 2 | 2 | 3 | LATER = TODO[:TODO.index("| 5 |")] + "| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |\n" # Item 9's row, the only one under release 0.3.0. NINTH = "| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |\n" +# A plan whose release 0.2.0 holds item 3 alone, before release 0.3.0's item 9. +SHIPPED_BUT_3 = TODO[:TODO.index("| 5 |")] + "| 3 | 0.2.0 | | | **Do the next thing.** | 2 | 2 | 3 | 5 | 3 | 1 by 9 | 56.2 |\n" + NINTH # An items table that holds no row. EMPTY = TODO[:TODO.index("| 5 |")] CHANGELOG = "# Changelog\n\n## Unreleased\n\n- One.\n - A nested line.\n- Two.\n\n## 0.1.0\n\n- Old.\n" @@ -587,6 +589,14 @@ class Plans(unittest.TestCase): self.assertIn("- Items 5, 3, 7 and 8 are filed under release 0.2.0, which is cut, so they count as release 0.3.0's, the next. Move them there in this chunk, with `~/.claude/bin/todo-item` where it moves this plan's items, and say so in the chunk's opening line.", said) self.assertNotIn("which is cut", rendered(item_facts())) + def test_says_to_move_one_or_two_items_of_a_release_already_cut_in_the_singular_or_the_plural(self): + cut = LastCut("v0.2.0", "", 4, []) + for todo, ids, said in ((SHIPPED_BUT_3, (3,), "- Item 3 is filed under release 0.2.0, which is cut, so it counts as release 0.3.0's, the next. Move it there in this chunk,"), (SHIPPED_BUT_3 + NINTH.replace("| 9 | 0.3.0 |", "| 4 | 0.1.0 |"), (3, 4), "- Items 3 and 4 are filed under release 0.2.0, which is cut, so they count as release 0.3.0's, the next. Move them there in this chunk,")): + with self.subTest(ids=ids): + plan = planned(todo, cut, "origin/main", BRANCH) + self.assertEqual(plan.carried, CarriedOver((0, 2, 0), (0, 3, 0), ids)) + self.assertIn(said, rendered(dataclasses.replace(item_facts(), plan=plan), cut)) + def test_says_the_plan_files_items_under_a_release_already_cut(self): why = planned(TODO.replace(NINTH, ""), LastCut("v0.2.0", "", 4, []), "origin/main", BRANCH).why self.assertIn("release 0.2.0", why)