def test_decode_bytes(self): cases = [ (u'%F6lk%FCrbis', u'ölkürbis'), (b'%F6lk%FCrbis', u'ölkürbis'.encode('iso-8859-1')) ] for input, output in cases: self.assertEqual(uridecode(input, encoding='iso-8859-1'), output)
def test_uridecode(self): cases = [ ('%', '%'), (b'%', b'%'), ('%ZZ', '%ZZ'), (b'%ZZ', b'%ZZ'), ('%Z', '%Z'), (b'%Z', b'%Z'), ('%Z%E3%81%82', '%Zあ'), ('%Z%E3%81%82a', '%Zあa') ] for input, output in cases: self.assertEqual(uridecode(input), output)
def check(self, decoded, encoded, safe='', encoding='utf-8'): self.assertEqual(uriencode(decoded, safe, encoding), encoded) self.assertEqual(uridecode(encoded, encoding), decoded)