~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the test trees used by the per_tree tests."""
18
18
 
 
19
from bzrlib import tests
19
20
from bzrlib.tests import per_tree
20
 
from bzrlib.tests import (
21
 
    features,
22
 
    )
23
21
 
24
22
 
25
23
class TestTreeShapes(per_tree.TestCaseWithTree):
32
30
        self.assertEqual([], tree.get_parent_ids())
33
31
        self.assertEqual([], tree.conflicts())
34
32
        self.assertEqual([], list(tree.unknowns()))
35
 
        self.assertEqual(['empty-root-id'], list(tree.all_file_ids()))
 
33
        self.assertEqual(['empty-root-id'], list(iter(tree)))
36
34
        self.assertEqual(
37
35
            [('', 'empty-root-id')],
38
36
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
48
46
        # __iter__ has no strongly defined order
49
47
        self.assertEqual(
50
48
            set(['root-id', 'a-id', 'b-id', 'c-id']),
51
 
            set(tree.all_file_ids()))
 
49
            set(iter(tree)))
52
50
        self.assertEqual(
53
51
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
54
52
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
66
64
        # __iter__ has no strongly defined order
67
65
        self.assertEqual(
68
66
            set(['root-id', 'a-id', 'b-id', 'c-id']),
69
 
            set(tree.all_file_ids()))
 
67
            set(iter(tree)))
70
68
        self.assertEqual(
71
69
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
72
70
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
84
82
        # __iter__ has no strongly defined order
85
83
        self.assertEqual(
86
84
            set(['root-id', 'a-id', 'b-id', 'c-id']),
87
 
            set(tree.all_file_ids()))
 
85
            set(iter(tree)))
88
86
        self.assertEqual(
89
87
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
90
88
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
102
100
        # __iter__ has no strongly defined order
103
101
        self.assertEqual(
104
102
            set(['root-id', 'a-id', 'b-id', 'c-id']),
105
 
            set(tree.all_file_ids()))
 
103
            set(iter(tree)))
106
104
        self.assertEqual(
107
105
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
108
106
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
120
118
        # __iter__ has no strongly defined order
121
119
        self.assertEqual(
122
120
            set(['root-id', 'a-id', 'b-id', 'c-id']),
123
 
            set(tree.all_file_ids()))
 
121
            set(iter(tree)))
124
122
        self.assertEqual(
125
123
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
126
124
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
138
136
        # __iter__ has no strongly defined order
139
137
        self.assertEqual(
140
138
            set(['root-id', 'a-id', 'b-id', 'c-id']),
141
 
            set(tree.all_file_ids()))
 
139
            set(iter(tree)))
142
140
        self.assertEqual(
143
141
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('e', 'c-id')],
144
142
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
149
147
        # currently this test tree requires unicode. It might be good
150
148
        # to have it simply stop having the single unicode file in it
151
149
        # when dealing with a non-unicode filesystem.
152
 
        self.requireFeature(features.SymlinkFeature)
 
150
        self.requireFeature(tests.SymlinkFeature)
153
151
        tree = self.get_tree_with_subdirs_and_all_content_types()
154
152
        tree.lock_read()
155
153
        self.addCleanup(tree.unlock)
167
165
                 u'0utf\u1234file'.encode('utf8'),
168
166
                'symlink',
169
167
                 ]),
170
 
            set(tree.all_file_ids()))
 
168
            set(iter(tree)))
171
169
        # note that the order of the paths and fileids is deliberately
172
170
        # mismatched to ensure that the result order is path based.
173
171
        self.assertEqual(
200
198
                '0dir-in-1topdir',
201
199
                 u'0utf\u1234file'.encode('utf8'),
202
200
                 ]),
203
 
            set(tree.all_file_ids()))
 
201
            set(iter(tree)))
204
202
        # note that the order of the paths and fileids is deliberately
205
203
        # mismatched to ensure that the result order is path based.
206
204
        self.assertEqual(