Пример #1
0
 def test_fix_unicode_path_leave_unicode_kwargs(self):
     _test_pairs = (('https://example.com/2017/12/abcdefgühijklmnop?a=%20foo&b=ü',
                     'https://example.com/2017/12/abcdefg%C3%BChijklmnop?a=%20foo&b=ü',
                     ),
                    )
     for (raw, expected) in _test_pairs:
         cleaned = metadata_parser.fix_unicode_url(raw)
         self.assertEqual(cleaned, expected)
         if not metadata_parser.PY3:
             cleaned = metadata_parser.fix_unicode_url(raw.decode('utf-8'), encoding='utf-8').encode('utf-8')
             self.assertEqual(cleaned, expected)
Пример #2
0
 def test_fix_unicode_path_leave_unicode_kwargs(self):
     _test_pairs = ((
         'https://example.com/2017/12/abcdefgühijklmnop?a=%20foo&b=ü',
         'https://example.com/2017/12/abcdefg%C3%BChijklmnop?a=%20foo&b=ü',
     ), )
     for (raw, expected) in _test_pairs:
         cleaned = metadata_parser.fix_unicode_url(raw)
         self.assertEqual(cleaned, expected)
         if six.PY2:
             cleaned = metadata_parser.fix_unicode_url(
                 raw.decode('utf-8'), encoding='utf-8').encode('utf-8')
             self.assertEqual(cleaned, expected)
Пример #3
0
 def test_fix_unicode_path(self):
     _test_pairs = ((
         "https://example.com/2017/12/abcdefgühijklmnop?a=%20foo",
         "https://example.com/2017/12/abcdefg%C3%BChijklmnop?a=%20foo",
     ), )
     for (raw, expected) in _test_pairs:
         cleaned = metadata_parser.fix_unicode_url(raw)
         self.assertEqual(cleaned, expected)
         if six.PY2:
             cleaned = metadata_parser.fix_unicode_url(
                 raw.decode("utf-8"), encoding="utf-8").encode("utf-8")
             self.assertEqual(cleaned, expected)