예제 #1
0
 def test_b32decode(self):
     eq = self.assertEqual
     eq(base64.b32decode(''), '')
     eq(base64.b32decode('AA======'), '\x00')
     eq(base64.b32decode('ME======'), 'a')
     eq(base64.b32decode('MFRA===='), 'ab')
     eq(base64.b32decode('MFRGG==='), 'abc')
     eq(base64.b32decode('MFRGGZA='), 'abcd')
     eq(base64.b32decode('MFRGGZDF'), 'abcde')
예제 #2
0
 def test_b32decode(self):
     eq = self.assertEqual
     eq(base64.b32decode(''), '')
     eq(base64.b32decode('AA======'), '\x00')
     eq(base64.b32decode('ME======'), 'a')
     eq(base64.b32decode('MFRA===='), 'ab')
     eq(base64.b32decode('MFRGG==='), 'abc')
     eq(base64.b32decode('MFRGGZA='), 'abcd')
     eq(base64.b32decode('MFRGGZDF'), 'abcde')
예제 #3
0
 def test_b32decode_casefold(self):
     eq = self.assertEqual
     eq(base64.b32decode('', True), '')
     eq(base64.b32decode('ME======', True), 'a')
     eq(base64.b32decode('MFRA====', True), 'ab')
     eq(base64.b32decode('MFRGG===', True), 'abc')
     eq(base64.b32decode('MFRGGZA=', True), 'abcd')
     eq(base64.b32decode('MFRGGZDF', True), 'abcde')
     # Lower cases
     eq(base64.b32decode('me======', True), 'a')
     eq(base64.b32decode('mfra====', True), 'ab')
     eq(base64.b32decode('mfrgg===', True), 'abc')
     eq(base64.b32decode('mfrggza=', True), 'abcd')
     eq(base64.b32decode('mfrggzdf', True), 'abcde')
     # Expected exceptions
     self.assertRaises(TypeError, base64.b32decode, 'me======')
     # Mapping zero and one
     eq(base64.b32decode('MLO23456'), 'b\xdd\xad\xf3\xbe')
     eq(base64.b32decode('M1023456', map01='L'), 'b\xdd\xad\xf3\xbe')
     eq(base64.b32decode('M1023456', map01='I'), 'b\x1d\xad\xf3\xbe')
예제 #4
0
 def test_b32decode_casefold(self):
     eq = self.assertEqual
     eq(base64.b32decode('', True), '')
     eq(base64.b32decode('ME======', True), 'a')
     eq(base64.b32decode('MFRA====', True), 'ab')
     eq(base64.b32decode('MFRGG===', True), 'abc')
     eq(base64.b32decode('MFRGGZA=', True), 'abcd')
     eq(base64.b32decode('MFRGGZDF', True), 'abcde')
     # Lower cases
     eq(base64.b32decode('me======', True), 'a')
     eq(base64.b32decode('mfra====', True), 'ab')
     eq(base64.b32decode('mfrgg===', True), 'abc')
     eq(base64.b32decode('mfrggza=', True), 'abcd')
     eq(base64.b32decode('mfrggzdf', True), 'abcde')
     # Expected exceptions
     self.assertRaises(TypeError, base64.b32decode, 'me======')
     # Mapping zero and one
     eq(base64.b32decode('MLO23456'), 'b\xdd\xad\xf3\xbe')
     eq(base64.b32decode('M1023456', map01='L'), 'b\xdd\xad\xf3\xbe')
     eq(base64.b32decode('M1023456', map01='I'), 'b\x1d\xad\xf3\xbe')