oslo.serialization/oslo_serialization/tests
Stephen Finucane ede68f08d3 Don't raise TypeError for invalid b64
In Python 2, the 'b64decode' function calls the 'binascii.a2b_base64'
function but catches any 'binascii.Error' exceptions raised and raises a
TypeError instead [1]. In Python 3, a 'binascii.Error' error is raised
instead [2]. Rather than forcing users to handle two types of exception,
we can allow them to catch only the 'bisascii.Error'. Python 2 provides
a function that does just this - 'decodestring' - which we can use. Make
it so.

[1] https://github.com/python/cpython/blob/2.7/Lib/base64.py#L78
[2] https://github.com/python/cpython/blob/3.5/Lib/base64.py#L87
[3] https://github.com/python/cpython/blob/2.7/Lib/base64.py#L326

Change-Id: I72c6de71b174181292427128d20e03756f85fb97
2016-12-14 16:16:41 +00:00
..
__init__.py Move files out of the namespace package 2015-01-05 15:40:06 -05:00
test_base64.py Don't raise TypeError for invalid b64 2016-12-14 16:16:41 +00:00
test_jsonutils.py Merge "Fix serialization of binary strings in Python3" 2016-08-04 13:31:57 +00:00
test_msgpackutils.py Replaces uuid.uuid4 with uuidutils.generate_uuid() 2016-12-05 11:12:56 +07:00