~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/test_ids.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2012 Canonical Ltd
 
1
# Copyright (C) 2012, 2016 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
16
16
 
17
17
from bzrlib import (
18
18
    errors,
19
 
    )
 
19
)
20
20
from bzrlib.tests.per_tree import TestCaseWithTree
21
21
 
 
22
 
22
23
class IdTests(TestCaseWithTree):
23
24
 
24
25
    def setUp(self):
30
31
        self.tree_a = self.workingtree_to_test_tree(work_a)
31
32
 
32
33
    def test_path2id(self):
33
 
        self.assertEquals('bla-id', self.tree_a.path2id('bla'))
34
 
        self.assertEquals('dir-id', self.tree_a.path2id('dir'))
 
34
        self.assertEqual('bla-id', self.tree_a.path2id('bla'))
 
35
        self.assertEqual('dir-id', self.tree_a.path2id('dir'))
35
36
        self.assertIs(None, self.tree_a.path2id('idontexist'))
36
37
 
37
38
    def test_path2id_list(self):
38
 
        self.assertEquals('bla-id', self.tree_a.path2id(['bla']))
39
 
        self.assertEquals('dir-id', self.tree_a.path2id(['dir']))
40
 
        self.assertEquals('file-id', self.tree_a.path2id(['dir', 'file']))
41
 
        self.assertEquals(self.tree_a.get_root_id(),
42
 
            self.tree_a.path2id([]))
 
39
        self.assertEqual('bla-id', self.tree_a.path2id(['bla']))
 
40
        self.assertEqual('dir-id', self.tree_a.path2id(['dir']))
 
41
        self.assertEqual('file-id', self.tree_a.path2id(['dir', 'file']))
 
42
        self.assertEqual(self.tree_a.get_root_id(),
 
43
                         self.tree_a.path2id([]))
43
44
        self.assertIs(None, self.tree_a.path2id(['idontexist']))
44
45
        self.assertIs(None, self.tree_a.path2id(['dir', 'idontexist']))
45
46
 
46
47
    def test_id2path(self):
47
48
        self.addCleanup(self.tree_a.lock_read().unlock)
48
 
        self.assertEquals('bla', self.tree_a.id2path('bla-id'))
49
 
        self.assertEquals('dir', self.tree_a.id2path('dir-id'))
50
 
        self.assertEquals('dir/file', self.tree_a.id2path('file-id'))
 
49
        self.assertEqual('bla', self.tree_a.id2path('bla-id'))
 
50
        self.assertEqual('dir', self.tree_a.id2path('dir-id'))
 
51
        self.assertEqual('dir/file', self.tree_a.id2path('file-id'))
51
52
        self.assertRaises(errors.NoSuchId, self.tree_a.id2path, 'nonexistant')