/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_chk_map.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for maps built on a CHK versionedfiles facility."""
18
18
 
19
 
from bzrlib import (
 
19
from .. import (
20
20
    chk_map,
21
21
    errors,
22
22
    groupcompress,
23
23
    osutils,
24
24
    tests,
25
25
    )
26
 
from bzrlib.chk_map import (
 
26
from ..chk_map import (
27
27
    CHKMap,
28
28
    InternalNode,
29
29
    LeafNode,
30
30
    Node,
31
31
    )
32
 
from bzrlib.static_tuple import StaticTuple
 
32
from ..static_tuple import StaticTuple
33
33
 
34
34
 
35
35
class TestNode(tests.TestCase):
1584
1584
        prefix, result = list(node.map(None, ("blue",), "red"))
1585
1585
        self.assertEqual("", prefix)
1586
1586
        self.assertEqual(2, len(result))
1587
 
        split_chars = set([result[0][0], result[1][0]])
1588
 
        self.assertEqual(set(["f", "b"]), split_chars)
 
1587
        split_chars = {result[0][0], result[1][0]}
 
1588
        self.assertEqual({"f", "b"}, split_chars)
1589
1589
        nodes = dict(result)
1590
1590
        node = nodes["f"]
1591
1591
        self.assertEqual({("foo bar",): "baz quux"}, self.to_dict(node, None))
1919
1919
        # Ensure test validity: nothing paged in below the root.
1920
1920
        self.assertEqual(2,
1921
1921
            len([value for value in node._items.values()
1922
 
                if type(value) is StaticTuple]))
 
1922
                if isinstance(value, StaticTuple)]))
1923
1923
        # now, mapping to k3 should add a k3 leaf
1924
1924
        prefix, nodes = node.map(None, ('k3',), 'quux')
1925
1925
        self.assertEqual("k", prefix)
1958
1958
        # Ensure test validity: nothing paged in below the root.
1959
1959
        self.assertEqual(2,
1960
1960
            len([value for value in node._items.values()
1961
 
                if type(value) is StaticTuple]))
 
1961
                if isinstance(value, StaticTuple)]))
1962
1962
        # now, mapping to k23 causes k22 ('k2' in node) to split into k22 and
1963
1963
        # k23, which for simplicity in the current implementation generates
1964
1964
        # a new internal node between node, and k22/k23.
2141
2141
        c_map.map(('aaa',), 'new aaa content')
2142
2142
        key2 = c_map._save()
2143
2143
        diff = self.get_difference([key2], [key1])
2144
 
        self.assertEqual(set([key1]), diff._all_old_chks)
 
2144
        self.assertEqual({key1}, diff._all_old_chks)
2145
2145
        self.assertEqual([], diff._old_queue)
2146
2146
        self.assertEqual([], diff._new_queue)
2147
2147