/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: Aaron Bentley
  • Date: 2006-11-17 04:06:03 UTC
  • mfrom: (2139 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: aaron.bentley@utoronto.ca-20061117040603-pgebxndswvwk26tt
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2005, 2006 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
75
75
        
76
76
        self.assert_('src-id' in inv)
77
77
 
 
78
    def test_non_directory_children(self):
 
79
        """Test path2id when a parent directory has no children"""
 
80
        inv = inventory.Inventory('tree_root')
 
81
        inv.add(inventory.InventoryFile('file-id','file', 
 
82
                                        parent_id='tree_root'))
 
83
        inv.add(inventory.InventoryLink('link-id','link', 
 
84
                                        parent_id='tree_root'))
 
85
        self.assertIs(None, inv.path2id('file/subfile'))
 
86
        self.assertIs(None, inv.path2id('link/subfile'))
 
87
 
78
88
    def test_iter_entries(self):
79
89
        inv = Inventory()
80
90
        
544
554
        os.unlink('b1/a')
545
555
        wt.revert([])
546
556
        self.assertEqual(len(wt.inventory), 1)
 
557
 
 
558
 
 
559
class TestIsRoot(TestCase):
 
560
    """Ensure our root-checking code is accurate."""
 
561
 
 
562
    def test_is_root(self):
 
563
        inv = Inventory('TREE_ROOT')
 
564
        self.assertTrue(inv.is_root('TREE_ROOT'))
 
565
        self.assertFalse(inv.is_root('booga'))
 
566
        inv.root.file_id = 'booga'
 
567
        self.assertFalse(inv.is_root('TREE_ROOT'))
 
568
        self.assertTrue(inv.is_root('booga'))
 
569
        # works properly even if no root is set
 
570
        inv.root = None
 
571
        self.assertFalse(inv.is_root('TREE_ROOT'))
 
572
        self.assertFalse(inv.is_root('booga'))