@@ -46,8 +46,8 @@ def test_plural_fuzzy_and_empty_translations(self):
4646 msgstr_plural = {0 : "ファイル" , 1 : "" })
4747 text = po_review .render_entry ("test.po" , old , new , 1 , "test.po" )
4848 self .assertIn ("Many files" , text )
49- self .assertIn (r "msgstr\[1\ ]: 複数のファイル" , text )
50- self .assertIn (r "msgstr\[1\ ]: (未翻訳)" , text )
49+ self .assertIn ("msgstr[1 ]: 複数のファイル" , text )
50+ self .assertIn ("msgstr[1 ]: (未翻訳)" , text )
5151 self .assertIn ("fuzzy(要確認) → 未翻訳" , text )
5252 new .msgstr_plural [1 ] = old .msgstr_plural [1 ]
5353 self .assertNotEqual (po_review .signature (old ), po_review .signature (new ))
@@ -63,17 +63,18 @@ def test_new_removed_and_obsolete_entries(self):
6363
6464 def test_markdown_and_html_are_literal (self ):
6565 text = ':func:`open` <tag> [link](url) **bold**\n \n ```\n next'
66- result = po_review .paragraph (text )
67- self .assertIn (r"`` :func:`open` `` \<tag\> \[link\](url) \*\*bold\*\*" , result )
68- self .assertIn ("> \n > \\ `\\ `\\ `" , result )
69- self .assertEqual ("> &copy; " , po_review .paragraph ("©" ))
66+ self .assertEqual (
67+ "**変更後**\n \n ````rst\n " + text + "\n ````\n " ,
68+ po_review .field ("変更後" , text ),
69+ )
70+ self .assertEqual ("**訳文**\n \n ```rst\n ©\n ```\n " ,
71+ po_review .field ("訳文" , "©" ))
7072
7173 def test_rst_roles_and_literals_do_not_need_backslash_escapes (self ):
7274 text = ':ref:`tut-object` と :py:class:`表示名 <module.Class>`、``a_b``。'
73- result = po_review .paragraph ( text )
75+ result = po_review .field ( "訳文" , text )
7476 self .assertEqual (
75- '> `` :ref:`tut-object` `` と `` :py:class:`表示名 <module.Class>` ``、'
76- '``` ``a_b`` ```。 ' , result ,
77+ '**訳文**\n \n ```rst\n ' + text + '\n ```\n ' , result ,
7778 )
7879 self .assertNotIn ("\\ " , result )
7980 self .assertEqual ("../../tutorial/classes.rst:422 (source)" ,
@@ -82,7 +83,19 @@ def test_rst_roles_and_literals_do_not_need_backslash_escapes(self):
8283 def test_code_examples_keep_indentation_and_cannot_close_fence (self ):
8384 code = '>>> if True:\n ... print("````")\n ````'
8485 result = po_review .field ("原文" , code )
85- self .assertIn ("`````text\n " + code + "\n `````" , result )
86+ self .assertIn ("`````rst\n " + code + "\n `````" , result )
87+
88+ def test_prose_line_breaks_and_spaces_are_preserved (self ):
89+ for text in (
90+ '一文目です。 続く長い文、さらに続きます。' ,
91+ '一文目です。\n 続く長い文、\n さらに続きます。 ::\n ' ,
92+ ' 先頭の空白。\n 末尾の空白。 ' ,
93+ ):
94+ with self .subTest (text = text ):
95+ self .assertEqual (
96+ '**訳文**\n \n ```rst\n ' + text + '\n ```\n ' ,
97+ po_review .field ("訳文" , text ),
98+ )
8699
87100
88101class GitReportTests (unittest .TestCase ):
0 commit comments