~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-02 05:45:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1851.
  • Revision ID: john@arbash-meinel.com-20060702054550-e535f24da694acb7
make_entry refuses to create non-normalized entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
200
199
        self.assertIsInstance(inventory.make_entry("directory", "name", ROOT_ID),
201
200
            inventory.InventoryDirectory)
202
201
 
 
202
    def test_make_entry_non_normalized(self):
 
203
        orig_normalized_filename = osutils.normalized_filename
 
204
 
 
205
        try:
 
206
            osutils.normalized_filename = osutils._accessible_normalized_filename
 
207
            entry = inventory.make_entry("file", u'a\u030a', ROOT_ID)
 
208
            self.assertEqual(u'\xe5', entry.name)
 
209
            self.assertIsInstance(entry, inventory.InventoryFile)
 
210
 
 
211
            osutils.normalized_filename = osutils._inaccessible_normalized_filename
 
212
            self.assertRaises(errors.InvalidNormalization,
 
213
                    inventory.make_entry, 'file', u'a\u030a', ROOT_ID)
 
214
        finally:
 
215
            osutils.normalized_filename = orig_normalized_filename
 
216
 
 
217
 
203
218
class TestEntryDiffing(TestCaseWithTransport):
204
219
 
205
220
    def setUp(self):