Пример #1
0
 def test_encodes_reserved_ascii_characters(self):
   self.assertEqual(utils.percent_encode(six.u(" !\"#$%&'()")),
                    six.u("%20%21%22%23%24%25%26%27%28%29"))
   self.assertEqual(utils.percent_encode(six.u("*+,/{|}:;")),
                    six.u("%2A%2B%2C%2F%7B%7C%7D%3A%3B"))
   self.assertEqual(utils.percent_encode(six.u("<=>?@[\\]^`")),
                    six.u("%3C%3D%3E%3F%40%5B%5C%5D%5E%60"))
Пример #2
0
 def test_encodes_reserved_ascii_characters(self):
     self.assertEqual(utils.percent_encode(six.u(" !\"#$%&'()")),
                      six.u("%20%21%22%23%24%25%26%27%28%29"))
     self.assertEqual(utils.percent_encode(six.u("*+,/{|}:;")),
                      six.u("%2A%2B%2C%2F%7B%7C%7D%3A%3B"))
     self.assertEqual(utils.percent_encode(six.u("<=>?@[\\]^`")),
                      six.u("%3C%3D%3E%3F%40%5B%5C%5D%5E%60"))
Пример #3
0
 def test_encodes_other_non_ascii_characters(self):
   if six.PY3:
       original = "支払い"
   else:
       original = codecs.lookup('utf-8').decode("支払い")[0]
   self.assertEqual(utils.percent_encode(original),
                    six.u("%E6%94%AF%E6%89%95%E3%81%84"))
Пример #4
0
 def test_encodes_other_non_ascii_characters(self):
     if six.PY3:
         original = "支払い"
     else:
         original = codecs.lookup('utf-8').decode("支払い")[0]
     self.assertEqual(utils.percent_encode(original),
                      six.u("%E6%94%AF%E6%89%95%E3%81%84"))
Пример #5
0
 def test_encodes_non_ascii_alpha_characters(self):
     self.assertEqual(utils.percent_encode(u"å"), u"%C3%A5")
Пример #6
0
 def test_doesnt_encode_unreserved_non_alphanum_chars(self):
     self.assertEqual(utils.percent_encode(u"-._~"), u"-._~")
Пример #7
0
 def test_doesnt_encode_digits(self):
     self.assertEqual(utils.percent_encode(u"1234567890"), u"1234567890")
Пример #8
0
 def test_doesnt_encode_uppercase_alpha_characters(self):
     self.assertEqual(utils.percent_encode(u"ABCXYZ"), u"ABCXYZ")
Пример #9
0
 def test_doesnt_encode_lowercase_alpha_characters(self):
     self.assertEqual(utils.percent_encode(u"abcxyz"), u"abcxyz")
Пример #10
0
 def test_doesnt_encode_lowercase_alpha_characters(self):
     self.assertEqual(utils.percent_encode(six.u("abcxyz")),
                      six.u("abcxyz"))
Пример #11
0
 def test_encodes_non_ascii_alpha_characters(self):
   if six.PY3:
       original = "å"
   else:
       original = codecs.lookup('utf-8').decode("å")[0]
   self.assertEqual(utils.percent_encode(original), six.u("%C3%A5"))
Пример #12
0
 def test_encodes_non_ascii_alpha_characters(self):
     if six.PY3:
         original = "å"
     else:
         original = codecs.lookup('utf-8').decode("å")[0]
     self.assertEqual(utils.percent_encode(original), six.u("%C3%A5"))
Пример #13
0
 def test_doesnt_encode_unreserved_non_alphanum_chars(self):
     self.assertEqual(utils.percent_encode(six.u("-._~")), six.u("-._~"))
Пример #14
0
 def test_doesnt_encode_digits(self):
     self.assertEqual(utils.percent_encode(six.u("1234567890")),
                      six.u("1234567890"))
Пример #15
0
 def test_doesnt_encode_uppercase_alpha_characters(self):
     self.assertEqual(utils.percent_encode(six.u("ABCXYZ")),
                      six.u("ABCXYZ"))
Пример #16
0
 def test_encodes_other_non_ascii_characters(self):
     self.assertEqual(utils.percent_encode(u"支払い"), u"%E6%94%AF%E6%89%95%E3%81%84")
Пример #17
0
 def test_works_with_empty_strings(self):
     self.assertEqual(utils.percent_encode(u""), u"")
Пример #18
0
 def test_works_with_empty_strings(self):
     self.assertEqual(utils.percent_encode(six.u("")), six.u(""))