~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-18 20:46:39 UTC
  • mto: This revision was merged to the branch mainline in revision 6383.
  • Revision ID: jelmer@canonical.com-20111218204639-qi1k2wbh2vsoda61
Add some tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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'))