~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-07 16:15:45 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060607161545-e3f87ba37d1d7eb9
cleanup urlutils

Show diffs side-by-side

added added

removed removed

Lines of Context:
265
265
        self.assertEqual(u'D:/path/to/r\xe4ksm\xf6rg\xe5s',
266
266
            from_url('file:///d|/path/to/r%C3%A4ksm%C3%B6rg%C3%A5s'))
267
267
        self.assertEqual(u'D:/path/to/r\xe4ksm\xf6rg\xe5s',
268
 
            from_url('file:///d|/path/to/r%c3%a4ksm%c3%b6rg%c3%a5s'))
 
268
            from_url('file:///d:/path/to/r%c3%a4ksm%c3%b6rg%c3%a5s'))
269
269
 
270
270
        self.assertRaises(InvalidURL, from_url, '/path/to/foo')
271
271
        # Not a valid _win32 url, no drive letter
277
277
        if sys.platform == 'win32':
278
278
            self.assertRaises(InvalidURL, split, 'file:///path/to/foo')
279
279
            self.assertEqual(('file:///C|/', 'foo'), split('file:///C|/foo'))
280
 
            self.assertEqual(('file:///C|/', ''), split('file:///C|/'))
 
280
            self.assertEqual(('file:///C:/', ''), split('file:///C:/'))
281
281
        else:
282
282
            self.assertEqual(('file:///', 'foo'), split('file:///foo'))
283
283
            self.assertEqual(('file:///', ''), split('file:///'))
310
310
        sts = urlutils.strip_trailing_slash
311
311
        if sys.platform == 'win32':
312
312
            self.assertEqual('file:///C|/', sts('file:///C|/'))
313
 
            self.assertEqual('file:///C|/foo', sts('file:///C|/foo'))
 
313
            self.assertEqual('file:///C:/foo', sts('file:///C:/foo'))
314
314
            self.assertEqual('file:///C|/foo', sts('file:///C|/foo/'))
315
315
        else:
316
316
            self.assertEqual('file:///', sts('file:///'))
345
345
            disp_url = urlutils.unescape_for_display(url, encoding=encoding)
346
346
            self.assertIsInstance(disp_url, unicode)
347
347
            self.assertEqual(expected, disp_url)
 
348
 
348
349
        test('http://foo', 'http://foo')
349
350
        if sys.platform == 'win32':
350
 
            test('C:/foo/path', 'file:///C|foo/path')
 
351
            test('C:/foo/path', 'file:///C|/foo/path')
 
352
            test('C:/foo/path', 'file:///C:/foo/path')
351
353
        else:
352
354
            test('/foo/path', 'file:///foo/path')
353
355
 
411
413
                    'file:///home/jelmer/branch/2b')
412
414
        test('../../branch/2b', 'sftp://host/home/jelmer/bar/2b',
413
415
                    'sftp://host/home/jelmer/branch/2b')
414
 
        test('../../branch/feature/2b', 'http://host/home/jelmer/bar/2b',
415
 
                    'http://host/home/jelmer/branch/feature/2b')
 
416
        test('../../branch/feature/%2b', 'http://host/home/jelmer/bar/%2b',
 
417
                    'http://host/home/jelmer/branch/feature/%2b')
416
418
        test('../../branch/feature/2b', 'http://host/home/jelmer/bar/2b/', 
417
419
                    'http://host/home/jelmer/branch/feature/2b')
418
420
        # relative_url should preserve a trailing slash