mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-12 05:36:40 +00:00
test(i18n): guard the backslash a rejection sample must not keep
The expectation in test_a_rejected_translation_never_spills_over_its_comment_line encoded the old mechanism, an escaped newline, which is what introduced the backslash that broke docs/tr and docs/zh. The invariant its name states still holds with a space, so the expectation moves and the fix stays. A second test asserts the property that actually prevents the defect: a sample containing [test\\_file.py] leaves no backslash in the comment, whatever babel does when it wraps it. Nothing guarded that before, which is why two unparseable catalogs only surfaced under a manual msgfmt run. make test-unit passes in the container: 7171 passed, 9 skipped, no failures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ab680130cc
commit
48db7feb5f
1 file changed
+8
-1
@@ -249,9 +249,16 @@ class TestRefusalIsRemembered(unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
message.user_comments[2],
|
||||
f"{REJECTED_PREFIX} erste Zeile\\nzweite Zeile",
|
||||
f"{REJECTED_PREFIX} erste Zeile zweite Zeile",
|
||||
)
|
||||
|
||||
def test_a_rejected_translation_carries_no_backslash(self):
|
||||
_, message = self._entry()
|
||||
|
||||
apply([message], [Rejected("See [test\\_file.py](../x.py)", "structure")])
|
||||
|
||||
self.assertNotIn("\\", message.user_comments[2])
|
||||
|
||||
def test_a_second_rejection_replaces_the_first(self):
|
||||
_, message = self._entry()
|
||||
|
||||
|
||||
Reference in new issue
Block a user