@@ -126,62 +126,29 @@ def test_nonexistent_file(self):
126126
127127class  Test_multi_input (unittest .TestCase ):
128128    """Tests for the issue https://github.com/python/cpython/issues/79516 
129-         msgfmt.py shall accept multiple input files and when imported 
130-         make shall be callable multiple times 
129+         msgfmt.py shall accept multiple input files 
131130    """ 
132131
133-     script  =  os .path .join (toolsdir , 'i18n' , 'msgfmt.py' )
134- 
135-     def  imp (self ):
136-         i18ndir  =  os .path .join (toolsdir , 'i18n' )
137-         sys .path .append (i18ndir )
138-         import  msgfmt 
139-         sys .path .remove (i18ndir )
140-         return  msgfmt 
141- 
142-     def  test_help (self ):
143-         """Test option -h""" 
144-         rc , stdout , stderr  =  assert_python_ok (self .script , '-h' )
145-         self .assertEqual (0 , rc )
146-         self .assertTrue (stderr .startswith (
147-             b'Generate binary message catalog from textual' 
148-             b' translation description.' 
149-         ))
150- 
151-     def  test_wrong (self ):
152-         """Test wrong option""" 
153-         rc , stdout , stderr  =  assert_python_failure (self .script , '-x' )
154-         self .assertEqual (1 , rc )
155-         self .assertTrue (stderr .startswith (
156-             b'Generate binary message catalog from textual' 
157-             b' translation description.' 
158-         ))
159- 
160-     def  test_outputfile (self ):
161-         """Test script with -o option - 1 single file, Windows EOL""" 
162-         with  temp_cwd (None ):
163-             assert_python_ok (self .script , '-o' , 'file1.mo' ,
164-                              data_dir  /  'file1_fr.po' )
165-             self .assertTrue (
166-                 filecmp .cmp (data_dir  /  'file1_fr.mo' , 'file1.mo' ),
167-                 'Wrong compiled file1_fr.mo' )
168- 
169132    def  test_no_outputfile (self ):
170-         """Test script without -o option - 1 single file, Unix EOL """ 
133+         """Test script without -o option - 1 single file""" 
171134        with  temp_cwd (None ):
172135            shutil .copy (data_dir  /  'file2_fr.po' , '.' )
173-             assert_python_ok (self . script , 'file2_fr.po' )
136+             assert_python_ok (msgfmt , 'file2_fr.po' )
174137            self .assertTrue (
175138                filecmp .cmp (data_dir  /  'file2_fr.mo' , 'file2_fr.mo' ),
176139                'Wrong compiled file2_fr.mo' )
177140
178141    def  test_both_with_outputfile (self ):
179-         """Test script with -o option and 2 input files""" 
180-         # msgfmt.py version 1.2 behaviour is to correctly merge the input 
181-         # files and to keep last entry when same entry occurs in more than 
182-         # one file 
142+         """Test script with -o option and 2 input files 
143+ 
144+         The current behaviour is to merge entries having distinct ids 
145+         and keep last one if the same id occurs in multiple files. 
146+ 
147+         Here the first file has Windows endings (cflr) while second has 
148+         Unix endings (lf) 
149+         """ 
183150        with  temp_cwd (None ):
184-             assert_python_ok (self . script , '-o' , 'file12.mo' ,
151+             assert_python_ok (msgfmt , '-o' , 'file12.mo' ,
185152                             data_dir  /  'file1_fr.po' ,
186153                             data_dir  /  'file2_fr.po' )
187154            self .assertTrue (
@@ -190,36 +157,18 @@ def test_both_with_outputfile(self):
190157
191158    def  test_both_without_outputfile (self ):
192159        """Test script without -o option and 2 input files""" 
193-         # msgfmt.py version 1.2 behaviour was that second mo file 
194-         # also merged previous po files 
160+ 
195161        with  temp_cwd (None ):
196162            shutil .copy (data_dir  / 'file1_fr.po' , '.' )
197163            shutil .copy (data_dir  / 'file2_fr.po' , '.' )
198-             assert_python_ok (self . script , 'file1_fr.po' , 'file2_fr.po' )
164+             assert_python_ok (msgfmt , 'file1_fr.po' , 'file2_fr.po' )
199165            self .assertTrue (
200166                filecmp .cmp (data_dir  /  'file1_fr.mo' , 'file1_fr.mo' ),
201167                'Wrong compiled file1_fr.mo' )
202168            self .assertTrue (
203169                filecmp .cmp (data_dir  /  'file2_fr.mo' , 'file2_fr.mo' ),
204170                'Wrong compiled file2_fr.mo' )
205171
206-     def  test_consecutive_make_calls (self ):
207-         """Directly calls make twice to prove bpo-9741 is fixed""" 
208-         sys .path .append (os .path .join (toolsdir , 'i18n' ))
209-         from  msgfmt  import  make 
210-         with  temp_cwd (None ):
211-             with  open ("file1_fr.po" , "wb" ) as  out :
212-                 out .write (self .file1_fr_po )
213-             with  open ("file2_fr.po" , "wb" ) as  out :
214-                 out .write (self .file2_fr_po )
215-             make ("file1_fr.po" , "file1_fr.mo" )
216-             make ("file2_fr.po" , "file2_fr.mo" )
217-             with  open ('file1_fr.mo' , 'rb' ) as  fin :
218-                 self .assertEqual (self .file1_fr_mo , fin .read ())
219-             with  open ('file2_fr.mo' , 'rb' ) as  fin :
220-                 self .assertEqual (self .file2_fr_mo , fin .read ())
221-         sys .path .pop ()
222- 
223172
224173def  update_catalog_snapshots ():
225174    for  po_file  in  data_dir .glob ('*.po' ):
0 commit comments