~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 01:56:41 UTC
  • mfrom: (6379.4.8 urlutils-quote)
  • Revision ID: pqm@pqm.ubuntu.com-20111219015641-k7fyhyf6rfgk93m2
(jelmer) Include quote() and unquote() directly in bzrlib.urlutils. (Jelmer
 Vernooij)

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'))