~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-10 15:58:09 UTC
  • mto: This revision was merged to the branch mainline in revision 4284.
  • Revision ID: jelmer@samba.org-20090410155809-kdibzcjvp7pdb83f
Fix missing import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005 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
17
17
"""Tests for the urlutils wrapper."""
18
18
 
19
19
import os
 
20
import re
20
21
import sys
21
22
 
22
23
from bzrlib import osutils, urlutils, win32utils
299
300
            from_url('file:///path/to/r%C3%A4ksm%C3%B6rg%C3%A5s'))
300
301
        self.assertEqual(u'/path/to/r\xe4ksm\xf6rg\xe5s',
301
302
            from_url('file:///path/to/r%c3%a4ksm%c3%b6rg%c3%a5s'))
302
 
        self.assertEqual(u'/path/to/r\xe4ksm\xf6rg\xe5s',
303
 
            from_url('file://localhost/path/to/r%c3%a4ksm%c3%b6rg%c3%a5s'))
304
303
 
305
304
        self.assertRaises(InvalidURL, from_url, '/path/to/foo')
306
 
        self.assertRaises(
307
 
            InvalidURL, from_url,
308
 
            'file://remotehost/path/to/r%c3%a4ksm%c3%b6rg%c3%a5s')
309
305
 
310
306
    def test_win32_local_path_to_url(self):
311
307
        to_url = urlutils._win32_local_path_to_url
676
672
                         '/bar', '/bar/baz'))
677
673
        self.assertEqual('.', urlutils.determine_relative_path(
678
674
                         '/bar', '/bar'))
679
 
 
680
 
 
681
 
class TestParseURL(TestCase):
682
 
 
683
 
    def test_parse_url(self):
684
 
        self.assertEqual(urlutils.parse_url('http://example.com:80/one'),
685
 
            ('http', None, None, 'example.com', 80, '/one'))
686
 
        self.assertEqual(urlutils.parse_url('http://[1:2:3::40]/one'),
687
 
                ('http', None, None, '1:2:3::40', None, '/one'))
688
 
        self.assertEqual(urlutils.parse_url('http://[1:2:3::40]:80/one'),
689
 
                ('http', None, None, '1:2:3::40', 80, '/one'))