summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_base64.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-05-28 12:27:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-05-28 12:27:29 (GMT)
commitea2b490f3dad99cfd677be9fd0c730622a723f38 (patch)
treeac37b1311dcd38f2aa9f56ffe92d50856fbee6b3 /Lib/test/test_base64.py
parentfef952a60749477cb612203cd09d208869b6e5e2 (diff)
downloadcpython-ea2b490f3dad99cfd677be9fd0c730622a723f38.zip
cpython-ea2b490f3dad99cfd677be9fd0c730622a723f38.tar.gz
cpython-ea2b490f3dad99cfd677be9fd0c730622a723f38.tar.bz2
Issue #18011: base64.b32decode() now raises a binascii.Error if there are
non-alphabet characters present in the input string to conform a docstring. Updated the module documentation.
Diffstat (limited to 'Lib/test/test_base64.py')
-rw-r--r--Lib/test/test_base64.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index abba5bf..13695de 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -244,8 +244,8 @@ class BaseXYTestCase(unittest.TestCase):
eq(base64.b32decode(data, True), res)
eq(base64.b32decode(data.decode('ascii'), True), res)
- self.assertRaises(TypeError, base64.b32decode, b'me======')
- self.assertRaises(TypeError, base64.b32decode, 'me======')
+ self.assertRaises(binascii.Error, base64.b32decode, b'me======')
+ self.assertRaises(binascii.Error, base64.b32decode, 'me======')
# Mapping zero and one
eq(base64.b32decode(b'MLO23456'), b'b\xdd\xad\xf3\xbe')
@@ -262,9 +262,11 @@ class BaseXYTestCase(unittest.TestCase):
eq(base64.b32decode(data_str, map01=map01), res)
eq(base64.b32decode(data, map01=map01_str), res)
eq(base64.b32decode(data_str, map01=map01_str), res)
+ self.assertRaises(binascii.Error, base64.b32decode, data)
+ self.assertRaises(binascii.Error, base64.b32decode, data_str)
def test_b32decode_error(self):
- for data in [b'abc', b'ABCDEF==']:
+ for data in [b'abc', b'ABCDEF==', b'==ABCDEF']:
with self.assertRaises(binascii.Error):
base64.b32decode(data)
with self.assertRaises(binascii.Error):