Skip to content

Commit 50e7145

Browse files
committed
Tests for extension corner cases for msgfmt.py
1 parent 743bdc5 commit 50e7145

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Lib/test/test_tools/test_msgfmt.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import filecmp
1212
import json
13+
import os.path
1314
import shutil
1415
import sys
1516
import unittest
@@ -187,6 +188,28 @@ def test_both_without_outputfile(self):
187188
'file2_fr_lf.mo'))
188189

189190

191+
class PONamesTest(unittest.TestCase):
192+
def test_no_extension(self):
193+
with temp_cwd(None):
194+
shutil.copy(data_dir / 'file1_fr_crlf.po', 'file1.fr.po')
195+
assert_python_ok(msgfmt, 'file1.fr')
196+
self.assertTrue(os.path.exists('file1.fr.mo'))
197+
198+
def test_wrong_extension(self):
199+
with temp_cwd(None):
200+
shutil.copy(data_dir / 'file1_fr_crlf.po', 'file1_fr.pox')
201+
assert_python_failure(msgfmt, 'file1_fr.pox')
202+
self.assertFalse(os.path.exists('file1_fr.mo'))
203+
self.assertFalse(os.path.exists('file1_fr.pox.mo'))
204+
205+
@unittest.skipUnless(sys.platform.startswith("win"), "uppercase on Windows")
206+
def test_MAJ_on_Windows(self):
207+
with temp_cwd(None):
208+
shutil.copy(data_dir / 'file1_fr_crlf.po', 'File1.PO')
209+
assert_python_ok(msgfmt, 'FIle1.Po')
210+
self.assertTrue(os.path.exists('file1.mo'))
211+
212+
190213
def make_message_files(mo_file, *po_files):
191214
compile_messages(mo_file, *po_files)
192215
# Create a human-readable JSON file which is

0 commit comments

Comments
 (0)