137
138
def test_canonical_path(self):
138
139
work_tree = self._make_canonical_test_tree()
140
if not isinstance(work_tree, InventoryTree):
141
raise tests.TestNotApplicable(
142
"test not applicable on non-inventory tests")
139
143
self.assertEqual('dir/file',
140
144
work_tree.get_canonical_inventory_path('Dir/File'))
142
146
def test_canonical_path_before_commit(self):
143
147
work_tree = self._make_canonical_test_tree(False)
144
# note: not committed.
148
if not isinstance(work_tree, InventoryTree):
149
raise tests.TestNotApplicable(
150
"test not applicable on non-inventory tests") # note: not committed.
145
151
self.assertEqual('dir/file',
146
152
work_tree.get_canonical_inventory_path('Dir/File'))
148
154
def test_canonical_path_dir(self):
149
155
# check it works when asked for just the directory portion.
150
156
work_tree = self._make_canonical_test_tree()
157
if not isinstance(work_tree, InventoryTree):
158
raise tests.TestNotApplicable(
159
"test not applicable on non-inventory tests")
151
160
self.assertEqual('dir', work_tree.get_canonical_inventory_path('Dir'))
153
162
def test_canonical_path_root(self):
154
163
work_tree = self._make_canonical_test_tree()
164
if not isinstance(work_tree, InventoryTree):
165
raise tests.TestNotApplicable(
166
"test not applicable on non-inventory tests")
155
167
self.assertEqual('', work_tree.get_canonical_inventory_path(''))
156
168
self.assertEqual('/', work_tree.get_canonical_inventory_path('/'))
158
170
def test_canonical_path_invalid_all(self):
159
171
work_tree = self._make_canonical_test_tree()
172
if not isinstance(work_tree, InventoryTree):
173
raise tests.TestNotApplicable(
174
"test not applicable on non-inventory tests")
160
175
self.assertEqual('foo/bar',
161
176
work_tree.get_canonical_inventory_path('foo/bar'))
163
178
def test_canonical_invalid_child(self):
164
179
work_tree = self._make_canonical_test_tree()
180
if not isinstance(work_tree, InventoryTree):
181
raise tests.TestNotApplicable(
182
"test not applicable on non-inventory tests")
165
183
self.assertEqual('dir/None',
166
184
work_tree.get_canonical_inventory_path('Dir/None'))
176
194
work_tree.add(['test/', 'test/file', 'Test'])
178
196
test_tree = self._convert_tree(work_tree)
197
if not isinstance(test_tree, InventoryTree):
198
raise tests.TestNotApplicable(
199
"test not applicable on non-inventory tests")
179
200
test_tree.lock_read()
180
201
self.addCleanup(test_tree.unlock)