/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: John Arbash Meinel
  • Date: 2009-09-24 19:26:45 UTC
  • mto: (4634.52.3 2.0)
  • mto: This revision was merged to the branch mainline in revision 4716.
  • Revision ID: john@arbash-meinel.com-20090924192645-hyy1ycnnk6u3j5j6
Catch a corner case that we were missing.
The CHKInventory tests were passing, but failed for test_inv because
we were passing None to _getitems(). That only failed for InternalNodes,
but we were using a structure that didn't have internal nodes.
So now the test is parameterized on a small CHKInventory page size
to force those things out into the open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1254
1254
        self.make_file(inv, 'subsub-file1', 'sub-dir1-id')
1255
1255
        self.make_file(inv, 'sub2-file1', 'dir2-id')
1256
1256
        chk_bytes = self.get_chk_bytes()
1257
 
        chk_inv = CHKInventory.from_inventory(chk_bytes, inv)
 
1257
        #  use a small maximum_size to force internal paging structures
 
1258
        chk_inv = CHKInventory.from_inventory(chk_bytes, inv,
 
1259
                        maximum_size=100,
 
1260
                        search_key_name='hash-255-way')
1258
1261
        bytes = ''.join(chk_inv.to_lines())
1259
1262
        return CHKInventory.deserialise(chk_bytes, bytes, ("revid",))
1260
1263
 
1323
1326
        self.assertExpand(['TREE_ROOT', 'dir1-id', 'sub-dir1-id',
1324
1327
                           'sub-file1-id', 'sub-file2-id', 'subsub-file1-id',
1325
1328
                          ], inv, ['dir1-id'])
 
1329
 
 
1330
    def test_from_root(self):
 
1331
        inv = self.make_simple_inventory()
 
1332
        self.assertExpand(['TREE_ROOT', 'dir1-id', 'dir2-id', 'sub-dir1-id',
 
1333
                           'sub-file1-id', 'sub-file2-id', 'sub2-file1-id',
 
1334
                           'subsub-file1-id', 'top-id'], inv, ['TREE_ROOT'])
 
1335
 
 
1336
    def test_top_level_file(self):
 
1337
        inv = self.make_simple_inventory()
 
1338
        self.assertExpand(['TREE_ROOT', 'top-id'], inv, ['top-id'])
 
1339
 
 
1340
    def test_subsub_file(self):
 
1341
        inv = self.make_simple_inventory()
 
1342
        self.assertExpand(['TREE_ROOT', 'dir1-id', 'sub-dir1-id',
 
1343
                           'subsub-file1-id'], inv, ['subsub-file1-id'])
 
1344
 
 
1345
    def test_sub_and_root(self):
 
1346
        inv = self.make_simple_inventory()
 
1347
        self.assertExpand(['TREE_ROOT', 'dir1-id', 'sub-dir1-id', 'top-id',
 
1348
                           'subsub-file1-id'], inv, ['top-id', 'subsub-file1-id'])