~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_patches.py

  • Committer: Aaron Bentley
  • Date: 2009-10-14 22:08:45 UTC
  • mto: (4634.97.2 2.0)
  • mto: This revision was merged to the branch mainline in revision 4770.
  • Revision ID: aaron@aaronbentley.com-20091014220845-3rj9vvba9r3r2hod
Ensure patch roundtripping.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        patchtext = self.datafile("patchtext.patch").read()
139
139
        self.compare_parsed(patchtext)
140
140
 
141
 
    def test_binary(self):
 
141
    def test_parse_binary(self):
142
142
        """Test parsing a whole patch"""
143
143
        patches = parse_patches(self.datafile("binary.patch"))
144
144
        self.assertIs(BinaryPatch, patches[0].__class__)
146
146
        self.assertContainsRe(patches[0].oldname, '^bar\t')
147
147
        self.assertContainsRe(patches[0].newname, '^qux\t')
148
148
        self.assertContainsRe(str(patches[0]),
149
 
                                  'Binary files bar\t.* and qux\t.* differ$')
 
149
                                  'Binary files bar\t.* and qux\t.* differ\n')
 
150
 
 
151
    def test_roundtrip_binary(self):
 
152
        patchtext = self.datafile("binary.patch").read()
 
153
        patches = parse_patches(patchtext.splitlines(True))
 
154
        self.assertEqual(patchtext, ''.join(str(p) for p in patches))
150
155
 
151
156
    def testInit(self):
152
157
        """Handle patches missing half the position, range tuple"""