28
28
self.assertEqual([], tree.conflicts())
29
29
self.assertEqual([], list(tree.unknowns()))
30
30
self.assertEqual([inventory.ROOT_ID], list(iter(tree)))
32
[('', inventory.ROOT_ID)],
33
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
35
def test_abc_tree_no_parents(self):
36
tree = self.get_tree_no_parents_abc_content()
37
self.assertEqual([], tree.get_parent_ids())
38
self.assertEqual([], tree.conflicts())
39
self.assertEqual([], list(tree.unknowns()))
40
# __iter__ has no strongly defined order
42
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
45
[('', inventory.ROOT_ID), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
46
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
47
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
48
self.assertFalse(tree.is_executable('c-id'))
50
def test_abc_tree_content_2_no_parents(self):
51
tree = self.get_tree_no_parents_abc_content_2()
52
self.assertEqual([], tree.get_parent_ids())
53
self.assertEqual([], tree.conflicts())
54
self.assertEqual([], list(tree.unknowns()))
55
# __iter__ has no strongly defined order
57
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
60
[('', inventory.ROOT_ID), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
61
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
62
self.assertEqualDiff('foobar\n', tree.get_file_text('a-id'))
63
self.assertFalse(tree.is_executable('c-id'))
65
def test_abc_tree_content_3_no_parents(self):
66
tree = self.get_tree_no_parents_abc_content_3()
67
self.assertEqual([], tree.get_parent_ids())
68
self.assertEqual([], tree.conflicts())
69
self.assertEqual([], list(tree.unknowns()))
70
# __iter__ has no strongly defined order
72
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
75
[('', inventory.ROOT_ID), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
76
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
77
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
78
self.assertTrue(tree.is_executable('c-id'))
80
def test_abc_tree_content_4_no_parents(self):
81
tree = self.get_tree_no_parents_abc_content_4()
82
self.assertEqual([], tree.get_parent_ids())
83
self.assertEqual([], tree.conflicts())
84
self.assertEqual([], list(tree.unknowns()))
85
# __iter__ has no strongly defined order
87
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
90
[('', inventory.ROOT_ID), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
91
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
92
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
93
self.assertFalse(tree.is_executable('c-id'))
95
def test_abc_tree_content_5_no_parents(self):
96
tree = self.get_tree_no_parents_abc_content_5()
97
self.assertEqual([], tree.get_parent_ids())
98
self.assertEqual([], tree.conflicts())
99
self.assertEqual([], list(tree.unknowns()))
100
# __iter__ has no strongly defined order
102
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
105
[('', inventory.ROOT_ID), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
106
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
107
self.assertEqualDiff('bar\n', tree.get_file_text('a-id'))
108
self.assertFalse(tree.is_executable('c-id'))
110
def test_abc_tree_content_6_no_parents(self):
111
tree = self.get_tree_no_parents_abc_content_6()
112
self.assertEqual([], tree.get_parent_ids())
113
self.assertEqual([], tree.conflicts())
114
self.assertEqual([], list(tree.unknowns()))
115
# __iter__ has no strongly defined order
117
set([inventory.ROOT_ID, 'a-id', 'b-id', 'c-id']),
120
[('', inventory.ROOT_ID), ('a', 'a-id'), ('b', 'b-id'), ('e', 'c-id')],
121
[(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
122
self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
123
self.assertTrue(tree.is_executable('c-id'))