163
163
# __iter__ has no strongly defined order
164
164
tree_root = tree.path2id('')
165
165
self.assertEqual(
171
u'0utf\u1234file'.encode('utf8'),
166
{tree.path2id(p) for p in [
167
'', '0file', '1top-dir', '1top-dir/1dir-in-1topdir',
168
'1top-dir/0file-in-1topdir', 'symlink', u'2utf\u1234file']},
174
169
set(tree.all_file_ids()))
175
170
# note that the order of the paths and fileids is deliberately
176
171
# mismatched to ensure that the result order is path based.
177
172
self.assertEqual(
178
[('', tree_root, 'directory'),
179
('0file', '2file', 'file'),
180
('1top-dir', '1top-dir', 'directory'),
181
(u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
182
('symlink', 'symlink', 'symlink'),
183
('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
184
('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
185
[(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
175
('1top-dir', 'directory'),
176
(u'2utf\u1234file', 'file'),
177
('symlink', 'symlink'),
178
('1top-dir/0file-in-1topdir', 'file'),
179
('1top-dir/1dir-in-1topdir', 'directory')],
180
[(path, node.kind) for path, node in tree.iter_entries_by_dir()])
187
182
def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
188
183
# currently this test tree requires unicode. It might be good
197
192
# __iter__ has no strongly defined order
198
193
tree_root = tree.path2id('')
199
194
self.assertEqual(
205
u'0utf\u1234file'.encode('utf8'),
207
set(tree.all_file_ids()))
195
{'', '0file', '1top-dir', '1top-dir/0file-in-1topdir',
196
'1top-dir/1dir-in-1topdir', u'2utf\u1234file'},
197
set(tree.all_versioned_paths()))
208
198
# note that the order of the paths and fileids is deliberately
209
199
# mismatched to ensure that the result order is path based.
210
200
self.assertEqual(
211
[('', tree_root, 'directory'),
212
('0file', '2file', 'file'),
213
('1top-dir', '1top-dir', 'directory'),
214
(u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
215
('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
216
('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
217
[(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
203
('1top-dir', 'directory'),
204
(u'2utf\u1234file', 'file'),
205
('1top-dir/0file-in-1topdir', 'file'),
206
('1top-dir/1dir-in-1topdir', 'directory')],
207
[(path, node.kind) for path, node in tree.iter_entries_by_dir()])
219
209
def test_tree_with_utf8(self):
220
210
tree = self.make_branch_and_tree('.')