~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Tests for maps built on a CHK versionedfiles facility."""
18
18
 
 
19
from itertools import izip
 
20
 
19
21
from bzrlib import (
20
22
    chk_map,
21
23
    errors,
40
42
        self.assertTrue(len(common) <= len(key))
41
43
        self.assertStartsWith(prefix, common)
42
44
        self.assertStartsWith(key, common)
43
 
        self.assertEqual(expected_common, common)
 
45
        self.assertEquals(expected_common, common)
44
46
 
45
47
    def test_common_prefix(self):
46
48
        self.assertCommonPrefix('beg', 'beg', 'begin')
224
226
            "      ('ddd',) 'initial ddd content'\n",
225
227
            c_map._dump_tree())
226
228
 
227
 
    def test_root_only_aaa_ddd_16(self):
 
229
    def test_one_deep_map_16(self):
228
230
        c_map = self.make_root_only_aaa_ddd_map(
229
231
                search_key_func=chk_map._search_key_16)
230
232
        # We use 'aaa' and 'ddd' because they happen to map to 'F' when using
377
379
            else:
378
380
                # Leaf nodes must have identical contents
379
381
                self.assertEqual(node_one._items, node_two._items)
380
 
        self.assertEqual([], node_two_stack)
 
382
        self.assertEquals([], node_two_stack)
381
383
 
382
384
    def assertCanonicalForm(self, chkmap):
383
385
        """Assert that the chkmap is in 'canonical' form.
1108
1110
        basis_get = basis._store.get_record_stream
1109
1111
        def get_record_stream(keys, order, fulltext):
1110
1112
            if ('sha1:1adf7c0d1b9140ab5f33bb64c6275fa78b1580b7',) in keys:
1111
 
                raise AssertionError("'aaa' pointer was followed %r" % keys)
 
1113
                self.fail("'aaa' pointer was followed %r" % keys)
1112
1114
            return basis_get(keys, order, fulltext)
1113
1115
        basis._store.get_record_stream = get_record_stream
1114
1116
        result = sorted(list(target.iter_changes(basis)))