werkator build succeeded after 00:43
See docs/prs/2026-10-05-PR#18-werkator-review-and-automerge.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #18 Co-authored-by: claude-code <claude-code@javagil.de>
29 lines
1.5 KiB
Python
29 lines
1.5 KiB
Python
import unittest
|
|
|
|
from werkrevisor import readiness
|
|
|
|
|
|
class ReadinessTest(unittest.TestCase):
|
|
def test_marked_ready_needs_a_recorded_change_from_wip(self):
|
|
for old, new, ready in (("WIP: Fix", "Fix", True), ("wip:Fix", "Fix", True), ("[WIP] Fix", "Fix", True),
|
|
("Fix", "Fix it", False), ("Fix", "WIP: Fix", False), ("WIP: Fix", "WIP: Fix it", False)):
|
|
with self.subTest(old=old, new=new):
|
|
event = {"type": "change_title", "old_title": old, "new_title": new}
|
|
self.assertIs(readiness.was_marked_ready([event], new), ready)
|
|
for timeline in ([{"type": "comment", "old_title": "WIP: a", "new_title": "a"}], [], None):
|
|
with self.subTest(timeline=timeline):
|
|
self.assertFalse(readiness.was_marked_ready(timeline, "a"))
|
|
|
|
def test_only_the_last_wip_change_counts(self):
|
|
ready = {"type": "change_title", "old_title": "WIP: Fix", "new_title": "Fix"}
|
|
back = {"type": "change_title", "old_title": "Fix", "new_title": "WIP: Fix"}
|
|
renamed = {"type": "change_title", "old_title": "Fix", "new_title": "Fix it"}
|
|
self.assertFalse(readiness.was_marked_ready([ready, back], "WIP: Fix"))
|
|
self.assertFalse(readiness.was_marked_ready([ready, back], "Fix"))
|
|
self.assertTrue(readiness.was_marked_ready([ready, back, ready, renamed], "Fix it"))
|
|
self.assertTrue(readiness.was_marked_ready([back, ready], "Fix"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|