~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2007-01-31 16:33:48 UTC
  • mto: This revision was merged to the branch mainline in revision 2248.
  • Revision ID: john@arbash-meinel.com-20070131163348-kkwfh7hvvm39tx8y
fix --Derror => -Derror (trivial)

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
                          '\xbb\xbb')
247
247
 
248
248
 
249
 
class TestSafeUtf8(TestCase):
250
 
 
251
 
    def test_from_ascii_string(self):
252
 
        f = 'foobar'
253
 
        self.assertEqual('foobar', osutils.safe_utf8(f))
254
 
 
255
 
    def test_from_unicode_string_ascii_contents(self):
256
 
        self.assertEqual('bargam', osutils.safe_utf8(u'bargam'))
257
 
 
258
 
    def test_from_unicode_string_unicode_contents(self):
259
 
        self.assertEqual('bargam\xc2\xae', osutils.safe_utf8(u'bargam\xae'))
260
 
 
261
 
    def test_from_utf8_string(self):
262
 
        self.assertEqual('foo\xc2\xae', osutils.safe_utf8('foo\xc2\xae'))
263
 
 
264
 
    def test_bad_utf8_string(self):
265
 
        self.assertRaises(BzrBadParameterNotUnicode,
266
 
                          osutils.safe_utf8, '\xbb\xbb')
267
 
 
268
 
 
269
 
class TestSafeRevisionId(TestCase):
270
 
 
271
 
    def test_from_ascii_string(self):
272
 
        f = 'foobar'
273
 
        self.assertEqual('foobar', osutils.safe_revision_id(f))
274
 
        self.assertIs(osutils.safe_utf8(f), f)
275
 
 
276
 
    def test_from_unicode_string_ascii_contents(self):
277
 
        self.assertEqual('bargam', osutils.safe_revision_id(u'bargam'))
278
 
 
279
 
    def test_from_unicode_string_unicode_contents(self):
280
 
        self.assertEqual('bargam\xc2\xae',
281
 
                         osutils.safe_revision_id(u'bargam\xae'))
282
 
 
283
 
    def test_from_utf8_string(self):
284
 
        self.assertEqual('foo\xc2\xae',
285
 
                         osutils.safe_revision_id('foo\xc2\xae'))
286
 
 
287
 
    def test_bad_utf8_string(self):
288
 
        # This check may eventually go away
289
 
        self.assertRaises(BzrBadParameterNotUnicode,
290
 
                          osutils.safe_utf8, '\xbb\xbb')
291
 
 
292
 
    def test_none(self):
293
 
        """Currently, None is a valid revision_id"""
294
 
        self.assertEqual(None, osutils.safe_revision_id(None))
295
 
 
296
 
 
297
249
class TestWin32Funcs(TestCase):
298
250
    """Test that the _win32 versions of os utilities return appropriate paths."""
299
251