~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012 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
725
725
 
726
726
 
727
727
class TestCwdToURL(TestCaseInTempDir):
728
 
    """Test that local_path_to_url works base on the cwd"""
 
728
    """Test that local_path_to_url works based on the cwd"""
729
729
 
730
730
    def test_dot(self):
731
731
        # This test will fail if getcwd is not ascii
1026
1026
            urlutils.file_relpath, "file:///A:/b", "file:///A:/")
1027
1027
        self.assertRaises(PathNotChild,
1028
1028
            urlutils.file_relpath, "file:///A:/b/c", "file:///A:/b")
 
1029
 
 
1030
 
 
1031
class QuoteTests(TestCase):
 
1032
 
 
1033
    def test_quote(self):
 
1034
        self.assertEqual('abc%20def', urlutils.quote('abc def'))
 
1035
        self.assertEqual('abc%2Fdef', urlutils.quote('abc/def', safe=''))
 
1036
        self.assertEqual('abc/def', urlutils.quote('abc/def', safe='/'))
 
1037
 
 
1038
    def test_quote_tildes(self):
 
1039
        self.assertEqual('%7Efoo', urlutils.quote('~foo'))
 
1040
        self.assertEqual('~foo', urlutils.quote('~foo', safe='/~'))
 
1041
 
 
1042
    def test_unquote(self):
 
1043
        self.assertEqual('%', urlutils.unquote('%25'))
 
1044
        self.assertEqual('\xc3\xa5', urlutils.unquote('%C3%A5'))
 
1045
        self.assertEqual(u"\xe5", urlutils.unquote(u'\xe5'))