/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/inventory_implementations/basics.py

  • Committer: Daniel Watkins
  • Date: 2007-11-06 09:33:05 UTC
  • mfrom: (2967 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2993.
  • Revision ID: d.m.watkins@warwick.ac.uk-20071106093305-zfef3c0jbcvunnuz
Merged bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        self.assertEqual('hello-id', ie.file_id)
66
66
        self.assertEqual('file', ie.kind)
67
67
 
 
68
    def test_copy(self):
 
69
        """Make sure copy() works and creates a deep copy."""
 
70
        inv = self.make_inventory(root_id='some-tree-root')
 
71
        ie = inv.add_path('hello', 'file', 'hello-id')
 
72
        inv2 = inv.copy()
 
73
        inv.root.file_id = 'some-new-root'
 
74
        ie.name = 'file2'
 
75
        self.assertEqual('some-tree-root', inv2.root.file_id)
 
76
        self.assertEqual('hello', inv2['hello-id'].name)
 
77
 
 
78
    def test_copy_empty(self):
 
79
        """Make sure an empty inventory can be copied."""
 
80
        inv = self.make_inventory(root_id=None)
 
81
        inv2 = inv.copy()
 
82
        self.assertIs(None, inv2.root)
 
83
 
68
84
    def test_is_root(self):
69
85
        """Ensure our root-checking code is accurate."""
70
86
        inv = self.make_inventory('TREE_ROOT')
202
218
            ], [(path, ie.file_id) for path, ie in inv.iter_entries_by_dir(
203
219
                specific_file_ids=('bye-id',))])
204
220
 
 
221
        self.assertEqual([
 
222
            ('', 'tree-root'),
 
223
            ('src', 'src-id'),
 
224
            ('src/bye.c', 'bye-id'),
 
225
            ], [(path, ie.file_id) for path, ie in inv.iter_entries_by_dir(
 
226
                specific_file_ids=('bye-id',), yield_parents=True)])
 
227
 
205
228
    def test_add_recursive(self):
206
229
        parent = InventoryDirectory('src-id', 'src', 'tree-root')
207
230
        child = InventoryFile('hello-id', 'hello.c', 'src-id')