Esempio n. 1
0
File: url.py Progetto: rsms/smisk
 def test_encode_decode_string_type(self):
   self.assertEquals(type(URL.encode(u"*****@*****.**")), type(u"*****@*****.**"))
   self.assertEquals(type(URL.encode("*****@*****.**")), type("*****@*****.**"))
   self.assertEquals(type(URL.escape(u"*****@*****.**")), type(u"*****@*****.**"))
   self.assertEquals(type(URL.escape("*****@*****.**")), type("*****@*****.**"))
   self.assertEquals(type(URL.decode(u"*****@*****.**")), type(u"*****@*****.**"))
   self.assertEquals(type(URL.decode("*****@*****.**")), type("*****@*****.**"))
Esempio n. 2
0
File: url.py Progetto: rsms/smisk
 def test_encode_decode(self):
   raw = "http://abc.se:12/mos/jäger/grek land/hej.html?mos=japp&öland=nej#ge-mig/då";
   escaped = URL.escape(raw)
   self.assertEquals(escaped,
     'http%3A//abc.se%3A12/mos/j%C3%A4ger/grek%20land/hej.html'\
     '?mos=japp&%C3%B6land=nej%23ge-mig/d%C3%A5')
   encoded = URL.encode(raw)
   self.assertEquals(encoded,
     'http%3A%2F%2Fabc.se%3A12%2Fmos%2Fj%C3%A4ger%2Fgrek%20land%2Fhej.html%3Fmos%3Djapp'\
     '%26%C3%B6land%3Dnej%23ge-mig%2Fd%C3%A5')
   self.assertEquals(URL.decode(escaped), raw)
   self.assertEquals(URL.decode(encoded), raw)
   self.assertEquals(URL.unescape(escaped), URL.decode(escaped))
   self.assertEquals(URL.decode("*****@*****.**"), "*****@*****.**")
Esempio n. 3
0
File: string.py Progetto: rsms/smisk
def tokenize_path(path):
  '''Deconstruct a URI path into standardized tokens.
  
  :param path: A pathname
  :type  path: string
  :rtype: list'''
  tokens = []
  for tok in strip_filename_extension(path).split('/'):
    tok = URL.decode(tok)
    if len(tok):
      tokens.append(tok)
  return tokens