/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 bzrlib/tests/test_patches.py

  • Committer: Benoît Pierre
  • Date: 2009-02-24 00:25:32 UTC
  • mfrom: (4035 +trunk)
  • mto: (4056.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 4058.
  • Revision ID: benoit.pierre@gmail.com-20090224002532-i2f64ou15pa7if2y
Merge with upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib.tests import TestCase
22
22
 
23
23
from bzrlib.iterablefile import IterableFile
24
 
from bzrlib.patches import (MalformedLine, 
25
 
                            MalformedHunkHeader, 
26
 
                            MalformedPatchHeader, 
27
 
                            ContextLine, 
 
24
from bzrlib.patches import (MalformedLine,
 
25
                            MalformedHunkHeader,
 
26
                            MalformedPatchHeader,
 
27
                            ContextLine,
28
28
                            InsertLine,
29
 
                            RemoveLine, 
30
 
                            difference_index, 
 
29
                            RemoveLine,
 
30
                            difference_index,
31
31
                            get_patch_names,
32
 
                            hunk_from_header, 
33
 
                            iter_patched, 
 
32
                            hunk_from_header,
 
33
                            iter_patched,
34
34
                            iter_patched_from_hunks,
35
35
                            parse_line,
36
36
                            parse_patch,
41
41
class PatchesTester(TestCase):
42
42
 
43
43
    def datafile(self, filename):
44
 
        data_path = os.path.join(os.path.dirname(__file__), 
 
44
        data_path = os.path.join(os.path.dirname(__file__),
45
45
                                 "test_patches_data", filename)
46
46
        return file(data_path, "rb")
47
47
 
257
257
        for patch in patches:
258
258
            patch_files.append((patch.oldname, patch.newname))
259
259
        self.assertEqual(patch_files, filenames)
 
260
 
 
261
    def testStatsValues(self):
 
262
        """Test the added, removed and hunks values for stats_values."""
 
263
        patch = parse_patch(self.datafile("diff"))
 
264
        self.assertEqual((299, 407, 48), patch.stats_values())