~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_tree.py

  • Committer: Martin Pool
  • Date: 2007-03-05 03:55:31 UTC
  • mto: (2255.2.180 subtree)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: mbp@sourcefrog.net-20070305035531-1t1wn6oy526vrb0q
Tree.id2path should raise NoSuchId, not return None.

Add tree implementation test for this and update WorkingTree_4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from bzrlib import (
 
18
    errors,
 
19
    )
17
20
from bzrlib.tests.tree_implementations import TestCaseWithTree
18
21
 
19
22
class TestAnnotate(TestCaseWithTree):
29
32
                self.assertEqual(tree_revision, revision)
30
33
        finally:
31
34
            tree.unlock()
 
35
 
 
36
 
 
37
class TestFileIds(TestCaseWithTree):
 
38
 
 
39
    def test_id2path(self):
 
40
        # translate from file-id back to path
 
41
        work_tree = self.make_branch_and_tree('wt')
 
42
        tree = self.get_tree_no_parents_abc_content(work_tree)
 
43
        tree.lock_read()
 
44
        try:
 
45
            self.assertEqual(u'a', tree.id2path('a-id'))
 
46
            # other ids give an error- don't return None for this case
 
47
            self.assertRaises(errors.NoSuchId, tree.id2path, 'a')
 
48
        finally:
 
49
            tree.unlock()