~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008-2011, 2016 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
 
 
21
19
from bzrlib import (
22
20
    chk_map,
23
21
    errors,
42
40
        self.assertTrue(len(common) <= len(key))
43
41
        self.assertStartsWith(prefix, common)
44
42
        self.assertStartsWith(key, common)
45
 
        self.assertEquals(expected_common, common)
 
43
        self.assertEqual(expected_common, common)
46
44
 
47
45
    def test_common_prefix(self):
48
46
        self.assertCommonPrefix('beg', 'beg', 'begin')
226
224
            "      ('ddd',) 'initial ddd content'\n",
227
225
            c_map._dump_tree())
228
226
 
229
 
    def test_one_deep_map_16(self):
 
227
    def test_root_only_aaa_ddd_16(self):
230
228
        c_map = self.make_root_only_aaa_ddd_map(
231
229
                search_key_func=chk_map._search_key_16)
232
230
        # We use 'aaa' and 'ddd' because they happen to map to 'F' when using
379
377
            else:
380
378
                # Leaf nodes must have identical contents
381
379
                self.assertEqual(node_one._items, node_two._items)
382
 
        self.assertEquals([], node_two_stack)
 
380
        self.assertEqual([], node_two_stack)
383
381
 
384
382
    def assertCanonicalForm(self, chkmap):
385
383
        """Assert that the chkmap is in 'canonical' form.
1110
1108
        basis_get = basis._store.get_record_stream
1111
1109
        def get_record_stream(keys, order, fulltext):
1112
1110
            if ('sha1:1adf7c0d1b9140ab5f33bb64c6275fa78b1580b7',) in keys:
1113
 
                self.fail("'aaa' pointer was followed %r" % keys)
 
1111
                raise AssertionError("'aaa' pointer was followed %r" % keys)
1114
1112
            return basis_get(keys, order, fulltext)
1115
1113
        basis._store.get_record_stream = get_record_stream
1116
1114
        result = sorted(list(target.iter_changes(basis)))