/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_tree.py

  • Committer: Martin Pool
  • Date: 2007-09-03 04:35:49 UTC
  • mfrom: (2778 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2779.
  • Revision ID: mbp@sourcefrog.net-20070903043549-0cfyrgx7z2h8ppks
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib import (
18
18
    errors,
19
19
    tests,
 
20
    conflicts,
20
21
    )
21
22
from bzrlib.tests import TestSkipped
22
23
from bzrlib.tests.tree_implementations import TestCaseWithTree
121
122
            tree.unlock()
122
123
 
123
124
 
 
125
class TestFileContent(TestCaseWithTree):
 
126
 
 
127
    def test_get_file(self):
 
128
        work_tree = self.make_branch_and_tree('wt')
 
129
        tree = self.get_tree_no_parents_abc_content_2(work_tree)
 
130
        tree.lock_read()
 
131
        try:
 
132
            # Test lookup without path works
 
133
            lines = tree.get_file('a-id').readlines()
 
134
            self.assertEqual(['foobar\n'], lines)
 
135
            # Test lookup with path works
 
136
            lines = tree.get_file('a-id', path='a').readlines()
 
137
            self.assertEqual(['foobar\n'], lines)
 
138
        finally:
 
139
            tree.unlock()
 
140
 
 
141
 
124
142
class TestExtractFilesBytes(TestCaseWithTree):
125
143
 
126
144
    def test_iter_files_bytes(self):
142
160
        self.assertRaises(errors.NoSuchId, lambda: list(
143
161
                          tree.iter_files_bytes(
144
162
                          [('qux-id', 'file1-notpresent')])))
 
163
 
 
164
 
 
165
class TestConflicts(TestCaseWithTree):
 
166
 
 
167
    def test_conflicts(self):
 
168
        """Tree.conflicts() should return a ConflictList instance."""
 
169
        work_tree = self.make_branch_and_tree('wt')
 
170
        tree = self._convert_tree(work_tree)
 
171
        self.assertIsInstance(tree.conflicts(), conflicts.ConflictList)