~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_btree_index.py

  • Committer: John Arbash Meinel
  • Date: 2008-08-22 02:18:27 UTC
  • mto: This revision was merged to the branch mainline in revision 3644.
  • Revision ID: john@arbash-meinel.com-20080822021827-682x4linhe28stky
Rename _parse_btree to _btree_serializer

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    node_tests, others = split_suite_by_condition(standard_tests,
41
41
        condition_isinstance(TestBTreeNodes))
42
42
    applier = TestScenarioApplier()
43
 
    import bzrlib._parse_btree_py as py_module
 
43
    import bzrlib._btree_serializer_py as py_module
44
44
    applier.scenarios = [('python', {'parse_btree': py_module})]
45
45
    if CompiledBtreeParserFeature.available():
46
46
        # Is there a way to do this that gets missing feature failures rather
47
47
        # than no indication to the user?
48
 
        import bzrlib._parse_btree_c as c_module
 
48
        import bzrlib._btree_serializer_c as c_module
49
49
        applier.scenarios.append(('C', {'parse_btree': c_module}))
50
50
    adapt_tests(node_tests, applier, others)
51
51
    return others
54
54
class _CompiledBtreeParserFeature(tests.Feature):
55
55
    def _probe(self):
56
56
        try:
57
 
            import bzrlib._parse_btree_c
 
57
            import bzrlib._btree_serializer_c
58
58
        except ImportError:
59
59
            return False
60
60
        return True
61
61
 
62
62
    def feature_name(self):
63
 
        return 'bzrlib._parse_btree_c'
 
63
        return 'bzrlib._btree_serializer_c'
64
64
 
65
65
CompiledBtreeParserFeature = _CompiledBtreeParserFeature()
66
66
 
265
265
            "B+Tree Graph Index 2\nnode_ref_lists=0\nkey_elements=1\nlen=800\n"
266
266
            "row_lengths=1,2\n",
267
267
            content[:77])
268
 
        # Check thelast page is well formed
 
268
        # Check the last page is well formed
269
269
        leaf2 = content[8192:]
270
270
        leaf2_bytes = zlib.decompress(leaf2)
271
271
        node = btree_index._LeafNode(leaf2_bytes, 1, 0)
827
827
class TestBTreeNodes(BTreeTestCase):
828
828
 
829
829
    def restore_parser(self):
830
 
        btree_index._parse_btree = self.saved_parser
 
830
        btree_index._btree_serializer = self.saved_parser
831
831
 
832
832
    def setUp(self):
833
833
        BTreeTestCase.setUp(self)
834
 
        self.saved_parser = btree_index._parse_btree
 
834
        self.saved_parser = btree_index._btree_serializer
835
835
        self.addCleanup(self.restore_parser)
836
 
        btree_index._parse_btree = self.parse_btree
 
836
        btree_index._btree_serializer = self.parse_btree
837
837
 
838
838
    def test_LeafNode_1_0(self):
839
839
        node_bytes = ("type=leaf\n"