This adds configuration for running tests with tox, and compatibility with PyPy and Python 3.
The biggest change here is to the __str__ and __unicode__ methods of the Unauthorized exception. __str__ used to return either bytes or unicode depending on the exception argument types (because of implicit conversion), and then __unicode__ would try to decode as ascii if necessary, sometimes resulting in a UnicodeDecodeError (and there were tests for this). Now the canonical implementation is moved to __unicode__ (aliased to __str__ on python 3) which decodes the exception arguments as utf-8 if necessary and returns unicode. That value is then encoded by __str__ on python 2 and __bytes__ on python 3.
This adds configuration for running tests with tox, and compatibility with PyPy and Python 3.
The biggest change here is to the
__str__
and__unicode__
methods of the Unauthorized exception.__str__
used to return either bytes or unicode depending on the exception argument types (because of implicit conversion), and then__unicode__
would try to decode as ascii if necessary, sometimes resulting in a UnicodeDecodeError (and there were tests for this). Now the canonical implementation is moved to__unicode__
(aliased to__str__
on python 3) which decodes the exception arguments as utf-8 if necessary and returns unicode. That value is then encoded by__str__
on python 2 and__bytes__
on python 3.