~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_dump_btree.py

  • Committer: Eric Siegerman
  • Date: 2011-02-08 23:06:34 UTC
  • mto: This revision was merged to the branch mainline in revision 5656.
  • Revision ID: pub08@davor.org-20110208230634-u7ek4qdxikw0wu4w
Fix traceback attempting to "bzr dump-btree --raw btree-with-0-rows".

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
        finally:
92
92
            out_f.close()
93
93
        out, err = self.run_bzr('dump-btree test.btree')
 
94
 
 
95
    def create_sample_empty_btree_index(self):
 
96
        builder = btree_index.BTreeBuilder(
 
97
            reference_lists=1, key_elements=2)
 
98
        out_f = builder.finish()
 
99
        try:
 
100
            self.build_tree_contents([('test.btree', out_f.read())])
 
101
        finally:
 
102
            out_f.close()
 
103
 
 
104
    def test_dump_empty_btree_smoke(self):
 
105
        self.create_sample_empty_btree_index()
 
106
        out, err = self.run_bzr('dump-btree test.btree')
 
107
        self.assertEqualDiff("", out)
 
108
 
 
109
    def test_dump_empty_btree_http_smoke(self):
 
110
        self.transport_readonly_server = http_server.HttpServer
 
111
        self.create_sample_empty_btree_index()
 
112
        url = self.get_readonly_url('test.btree')
 
113
        out, err = self.run_bzr(['dump-btree', url])
 
114
        self.assertEqualDiff("", out)
 
115
 
 
116
    def test_dump_empty_btree_raw_smoke(self):
 
117
        self.create_sample_empty_btree_index()
 
118
        out, err = self.run_bzr('dump-btree test.btree --raw')
 
119
        self.assertEqualDiff(
 
120
            'Root node:\n'
 
121
            'B+Tree Graph Index 2\n'
 
122
            'node_ref_lists=1\n'
 
123
            'key_elements=2\n'
 
124
            'len=0\n'
 
125
            'row_lengths=\n'
 
126
            '\n'
 
127
            'Page 0\n'
 
128
            '(empty)\n',
 
129
            out)
 
130