~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

Clean up the lock.py code to use less indenting, and conform to better coding practise.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
                del os.environ['EDITOR']
188
188
            else:
189
189
                os.environ['EDITOR'] = editor
190
 
 
191
 
    def test__create_temp_file_with_commit_template(self):
192
 
        # check that commit template written properly
193
 
        # and has platform native line-endings (CRLF on win32)
194
 
        create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
195
 
        msgfilename, hasinfo = create_file('infotext','----','start message')
196
 
        self.assertNotEqual(None, msgfilename)
197
 
        self.assertTrue(hasinfo)
198
 
        expected = os.linesep.join(['start message',
199
 
                                    '',
200
 
                                    '',
201
 
                                    '----',
202
 
                                    '',
203
 
                                    'infotext'])
204
 
        self.assertFileEqual(expected, msgfilename)
205
 
 
206
 
    def test__create_temp_file_with_empty_commit_template(self):
207
 
        # empty file
208
 
        create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
209
 
        msgfilename, hasinfo = create_file('')
210
 
        self.assertNotEqual(None, msgfilename)
211
 
        self.assertFalse(hasinfo)
212
 
        self.assertFileEqual('', msgfilename)