302
302
def test_bad_utf8_string(self):
303
303
# This check may eventually go away
304
304
self.assertRaises(BzrBadParameterNotUnicode,
305
osutils.safe_utf8, '\xbb\xbb')
305
osutils.safe_revision_id, '\xbb\xbb')
307
307
def test_none(self):
308
308
"""Currently, None is a valid revision_id"""
309
309
self.assertEqual(None, osutils.safe_revision_id(None))
312
class TestSafeFileId(TestCase):
314
def test_from_ascii_string(self):
316
self.assertEqual('foobar', osutils.safe_file_id(f))
318
def test_from_unicode_string_ascii_contents(self):
319
self.assertEqual('bargam', osutils.safe_file_id(u'bargam'))
321
def test_from_unicode_string_unicode_contents(self):
322
self.assertEqual('bargam\xc2\xae',
323
osutils.safe_file_id(u'bargam\xae'))
325
def test_from_utf8_string(self):
326
self.assertEqual('foo\xc2\xae',
327
osutils.safe_file_id('foo\xc2\xae'))
329
def test_bad_utf8_string(self):
330
# This check may eventually go away
331
self.assertRaises(BzrBadParameterNotUnicode,
332
osutils.safe_file_id, '\xbb\xbb')
335
"""Currently, None is a valid revision_id"""
336
self.assertEqual(None, osutils.safe_file_id(None))
312
339
class TestWin32Funcs(TestCase):
313
340
"""Test that the _win32 versions of os utilities return appropriate paths."""