/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_versionedfile.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for VersionedFile classes"""
18
18
 
19
 
from .. import (
 
19
from bzrlib import (
20
20
    errors,
 
21
    groupcompress,
21
22
    multiparent,
22
23
    tests,
23
 
    )
24
 
from ..bzr import (
25
 
    groupcompress,
26
24
    versionedfile,
27
25
    )
28
26
 
90
88
        self.assertEqual(sorted([('one',), ('two',), ('three',)]),
91
89
                         sorted(gen.needed_keys))
92
90
        stream = vf.get_record_stream(gen.needed_keys, 'topological', True)
93
 
        record = next(stream)
 
91
        record = stream.next()
94
92
        self.assertEqual(('one',), record.key)
95
93
        # one is not needed in the output, but it is needed by children. As
96
94
        # such, it should end up in the various caches
97
95
        gen._process_one_record(record.key, record.get_bytes_as('chunked'))
98
96
        # The chunks should be cached, the refcount untouched
99
 
        self.assertEqual({('one',)}, set(gen.chunks))
 
97
        self.assertEqual([('one',)], gen.chunks.keys())
100
98
        self.assertEqual({('one',): 2, ('two',): 1}, gen.refcounts)
101
 
        self.assertEqual(set(), set(gen.diffs))
 
99
        self.assertEqual([], gen.diffs.keys())
102
100
        # Next we get 'two', which is something we output, but also needed for
103
101
        # three
104
 
        record = next(stream)
 
102
        record = stream.next()
105
103
        self.assertEqual(('two',), record.key)
106
104
        gen._process_one_record(record.key, record.get_bytes_as('chunked'))
107
105
        # Both are now cached, and the diff for two has been extracted, and
108
106
        # one's refcount has been updated. two has been removed from the
109
107
        # parent_map
110
 
        self.assertEqual({('one',), ('two',)}, set(gen.chunks))
 
108
        self.assertEqual(sorted([('one',), ('two',)]),
 
109
                         sorted(gen.chunks.keys()))
111
110
        self.assertEqual({('one',): 1, ('two',): 1}, gen.refcounts)
112
 
        self.assertEqual({('two',)}, set(gen.diffs))
 
111
        self.assertEqual([('two',)], gen.diffs.keys())
113
112
        self.assertEqual({('three',): (('one',), ('two',))},
114
113
                         gen.parent_map)
115
114
        # Finally 'three', which allows us to remove all parents from the
116
115
        # caches
117
 
        record = next(stream)
 
116
        record = stream.next()
118
117
        self.assertEqual(('three',), record.key)
119
118
        gen._process_one_record(record.key, record.get_bytes_as('chunked'))
120
119
        # Both are now cached, and the diff for two has been extracted, and
121
120
        # one's refcount has been updated
122
 
        self.assertEqual(set(), set(gen.chunks))
 
121
        self.assertEqual([], gen.chunks.keys())
123
122
        self.assertEqual({}, gen.refcounts)
124
 
        self.assertEqual({('two',), ('three',)}, set(gen.diffs))
 
123
        self.assertEqual(sorted([('two',), ('three',)]),
 
124
                         sorted(gen.diffs.keys()))
125
125
 
126
126
    def test_compute_diffs(self):
127
127
        vf = self.make_three_vf()