Files
werkrevisor/tests/test_diff_marker_note.py
claude-code 934a0bdc78
werkator build succeeded after 00:37
werkator/werkrevisor-statistics build succeeded after 00:40
werkrevisor 0.32.7: a plus in the text is no added line (#80)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-11 08:55:09 +02:00

38 lines
1.2 KiB
Python

import unittest
from tests.fakes import FakeGitea, FakeModel, gitea_file
from tests.test_flow import run
from werkrevisor.rules import DIFF_MARKER_NOTE
PLAN = "doc/werkregie.werkbaum"
def plan_diff(context):
lines = [f"diff --git a/{PLAN} b/{PLAN}", f"--- a/{PLAN}", f"+++ b/{PLAN}", "@@ -1,2 +1,3 @@",
" " + context, "+ - [ ] #dash.taiga: Taiga", " #dash.taiga"]
return "\n".join(lines) + "\n"
def instructions(context):
model = FakeModel(prompt_files=[PLAN])
run(FakeGitea(files=[gitea_file(PLAN)], diff=plan_diff(context)), model)
return model.calls[0]
class DiffMarkerNoteTest(unittest.TestCase):
def test_an_unchanged_line_with_a_plus_gets_the_note(self):
"""Scenario#80.01"""
self.assertIn(DIFF_MARKER_NOTE, instructions(" + [?] #dash.notify: Matrix as a notification channel"))
def test_a_plain_diff_gets_no_note(self):
"""Scenario#80.02"""
self.assertNotIn(DIFF_MARKER_NOTE, instructions("[~] #werkregie: Werkregie"))
def test_an_unchanged_markdown_item_gets_the_note(self):
"""Scenario#80.01"""
self.assertIn(DIFF_MARKER_NOTE, instructions("- an item of a list"))
if __name__ == "__main__":
unittest.main()