/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_patches.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-11 20:19:38 UTC
  • mfrom: (7526.3.2 work)
  • Revision ID: gustav.hartvigsson@gmail.com-20210111201938-omr9wjz3qdgyxe8k
MergedĀ lp:brz

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 
87
87
    def testValidPatchHeader(self):
88
88
        """Parse a valid patch header"""
 
89
        lines = (
 
90
            b"--- orig/commands.py\t2020-09-09 23:39:35 +0000\n"
 
91
            b"+++ mod/dommands.py\t2020-09-09 23:39:35 +0000\n").split(b'\n')
 
92
        (orig, mod) = get_patch_names(lines.__iter__())
 
93
        self.assertEqual(
 
94
            orig, (b"orig/commands.py", b'2020-09-09 23:39:35 +0000'))
 
95
        self.assertEqual(
 
96
            mod, (b"mod/dommands.py", b'2020-09-09 23:39:35 +0000'))
 
97
 
 
98
    def testValidPatchHeaderMissingTimestamps(self):
 
99
        """Parse a valid patch header"""
89
100
        lines = b"--- orig/commands.py\n+++ mod/dommands.py\n".split(b'\n')
90
101
        (orig, mod) = get_patch_names(lines.__iter__())
91
 
        self.assertEqual(orig, b"orig/commands.py")
92
 
        self.assertEqual(mod, b"mod/dommands.py")
 
102
        self.assertEqual(orig, (b"orig/commands.py", None))
 
103
        self.assertEqual(mod, (b"mod/dommands.py", None))
93
104
 
94
105
    def testInvalidPatchHeader(self):
95
106
        """Parse an invalid patch header"""
181
192
        patches = list(parse_patches(self.data_lines("binary.patch")))
182
193
        self.assertIs(BinaryPatch, patches[0].__class__)
183
194
        self.assertIs(Patch, patches[1].__class__)
184
 
        self.assertContainsRe(patches[0].oldname, b'^bar\t')
185
 
        self.assertContainsRe(patches[0].newname, b'^qux\t')
 
195
        self.assertEqual(patches[0].oldname, b'bar')
 
196
        self.assertEqual(patches[0].newname, b'qux')
186
197
        self.assertContainsRe(patches[0].as_bytes(),
187
 
                              b'Binary files bar\t.* and qux\t.* differ\n')
 
198
                              b'Binary files bar and qux differ\n')
188
199
 
189
200
    def test_parse_binary_after_normal(self):
190
201
        patches = list(parse_patches(