diff --git a/changedetectionio/tests/unit/test_notification_diff.py b/changedetectionio/tests/unit/test_notification_diff.py index d193f698..0ec31f9f 100755 --- a/changedetectionio/tests/unit/test_notification_diff.py +++ b/changedetectionio/tests/unit/test_notification_diff.py @@ -496,6 +496,27 @@ Line 3 with tabs and spaces""" self.assertIn('PLACEMARKER', raw) + def test_word_diff_no_prefix_exact_output(self): + """Pin exact output for include_change_type_prefix=False to catch regressions. + + Whole-line replacement: old and new values separated by newline, no markers. + Inline partial replacement: equal tokens kept, changed tokens (both old and new) + appended without markers — this means old+new are concatenated in place. + """ + # Whole-line replaced: both values on separate lines, clean + raw = diff.render_diff('73', '100', word_diff=True, include_change_type_prefix=False) + self.assertEqual(raw, '73\n100') + + # Inline word replacement: equal context preserved, old+new token concatenated in-place + raw = diff.render_diff('the price is 50 dollars', 'the price is 75 dollars', + word_diff=True, include_change_type_prefix=False) + self.assertEqual(raw, 'the price is 5075 dollars') + + # Sanity: with prefix the whole-line case is fully wrapped + raw = diff.render_diff('73', '100', word_diff=True, include_change_type_prefix=True) + self.assertEqual(raw, '@changed_PLACEMARKER_OPEN73@changed_PLACEMARKER_CLOSED\n' + '@changed_into_PLACEMARKER_OPEN100@changed_into_PLACEMARKER_CLOSED') + if __name__ == '__main__': unittest.main()