119
120
self.assertRaises(errors.NoSuchId, tree.id2path, 'a')
125
class TestExtractFilesBytes(TestCaseWithTree):
127
def test_iter_files_bytes(self):
128
work_tree = self.make_branch_and_tree('wt')
129
self.build_tree_contents([('wt/foo', 'foo'),
132
work_tree.add(['foo', 'bar', 'baz'], ['foo-id', 'bar-id', 'baz-id'])
133
tree = self._convert_tree(work_tree)
135
self.addCleanup(tree.unlock)
136
extracted = dict((i, ''.join(b)) for i, b in
137
tree.iter_files_bytes([('foo-id', 'id1'),
140
self.assertEqual('foo', extracted['id1'])
141
self.assertEqual('bar', extracted['id2'])
142
self.assertEqual('baz', extracted['id3'])
143
self.assertRaises(errors.NoSuchId, lambda: list(
144
tree.iter_files_bytes(
145
[('qux-id', 'file1-notpresent')])))
148
class TestConflicts(TestCaseWithTree):
150
def test_conflicts(self):
151
"""Tree.conflicts() should return a ConflictList instance."""
152
work_tree = self.make_branch_and_tree('wt')
153
tree = self._convert_tree(work_tree)
154
self.assertIsInstance(tree.conflicts(), conflicts.ConflictList)