/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/test_inv.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005 by Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
import os
19
19
import time
20
20
 
 
21
from bzrlib import errors, inventory, osutils
21
22
from bzrlib.branch import Branch
22
 
import bzrlib.errors as errors
23
23
from bzrlib.diff import internal_diff
24
24
from bzrlib.inventory import (Inventory, ROOT_ID, InventoryFile,
25
25
    InventoryDirectory, InventoryEntry)
26
 
import bzrlib.inventory as inventory
27
26
from bzrlib.osutils import (has_symlinks, rename, pathjoin, is_inside_any, 
28
27
    is_inside_or_parent_of_any)
29
28
from bzrlib.tests import TestCase, TestCaseWithTransport
87
86
            inv.add_path(*args)
88
87
 
89
88
        self.assertEqual([
 
89
            ('', ROOT_ID),
90
90
            ('Makefile', 'makefile-id'),
91
91
            ('doc', 'doc-id'),
92
92
            ('src', 'src-id'),
109
109
            inv.add_path(*args)
110
110
 
111
111
        self.assertEqual([
 
112
            ('', ROOT_ID),
112
113
            ('Makefile', 'makefile-id'),
113
114
            ('doc', 'doc-id'),
114
115
            ('src', 'src-id'),
200
201
        self.assertIsInstance(inventory.make_entry("directory", "name", ROOT_ID),
201
202
            inventory.InventoryDirectory)
202
203
 
 
204
    def test_make_entry_non_normalized(self):
 
205
        orig_normalized_filename = osutils.normalized_filename
 
206
 
 
207
        try:
 
208
            osutils.normalized_filename = osutils._accessible_normalized_filename
 
209
            entry = inventory.make_entry("file", u'a\u030a', ROOT_ID)
 
210
            self.assertEqual(u'\xe5', entry.name)
 
211
            self.assertIsInstance(entry, inventory.InventoryFile)
 
212
 
 
213
            osutils.normalized_filename = osutils._inaccessible_normalized_filename
 
214
            self.assertRaises(errors.InvalidNormalization,
 
215
                    inventory.make_entry, 'file', u'a\u030a', ROOT_ID)
 
216
        finally:
 
217
            osutils.normalized_filename = orig_normalized_filename
 
218
 
 
219
 
203
220
class TestEntryDiffing(TestCaseWithTransport):
204
221
 
205
222
    def setUp(self):