~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
        lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
221
221
 
222
222
        cmd = ['diff', '-u', '--binary', 'old', 'new']
223
 
        open('old', 'wb').write('\x00foobar\n')
224
 
        open('new', 'wb').write('foo\x00bar\n')
 
223
        with open('old', 'wb') as f: f.write('\x00foobar\n')
 
224
        with open('new', 'wb') as f: f.write('foo\x00bar\n')
225
225
        pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
226
226
                                     stdin=subprocess.PIPE)
227
227
        out, err = pipe.communicate()
1191
1191
                 'how are you today?\n']
1192
1192
        txt_b = ['hello there\n',
1193
1193
                 'how are you today?\n']
1194
 
        open('a1', 'wb').writelines(txt_a)
1195
 
        open('b1', 'wb').writelines(txt_b)
 
1194
        with open('a1', 'wb') as f: f.writelines(txt_a)
 
1195
        with open('b1', 'wb') as f: f.writelines(txt_b)
1196
1196
 
1197
1197
        unified_diff_files = patiencediff.unified_diff_files
1198
1198
        psm = self._PatienceSequenceMatcher
1208
1208
 
1209
1209
        txt_a = map(lambda x: x+'\n', 'abcdefghijklmnop')
1210
1210
        txt_b = map(lambda x: x+'\n', 'abcdefxydefghijklmnop')
1211
 
        open('a2', 'wb').writelines(txt_a)
1212
 
        open('b2', 'wb').writelines(txt_b)
 
1211
        with open('a2', 'wb') as f: f.writelines(txt_a)
 
1212
        with open('b2', 'wb') as f: f.writelines(txt_b)
1213
1213
 
1214
1214
        # This is the result with LongestCommonSubstring matching
1215
1215
        self.assertEquals(['--- a2\n',