Update unit tests for Python 3.5 compatability
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dbase32 |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
Python 3.5 makes some changes in the exact TypeError messages used when it comes to the Python Buffer Protocol.
Specifically for Dbase32, the C backend TypeError messages will differ on Python 3.4 vs 3.5 when the "y#" and "s#" formats are used with PyArg_ParseTuple(), which effects 4 of the 6 dbase32 functions:
dbase32.db32enc()
dbase32.db32dec()
dbase32.isdb32()
dbase32.
For example, Python 3.4:
>>> from dbase32 import db32dec
>>> db32dec(76)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' does not support the buffer interface
Vs Python 3.5:
>>> from dbase32 import db32dec
>>> db32dec(76)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'int'
So the Dbase32 unit tests need to be updated to test against the new TypeError message format for Python >= 3.5, while still also being able to test against the old TypeError format for Python < 3.5, as Python 3.4 support isn't being dropped. (Actually, Dbase32 should still be compatible with Python 3.3 as well, but that's not actively tested by me anymore, so YMMV.)
A small update is also needed in the pure-Python dbase32._dbase32py fallback/reference implementation as it emulates the TypeError behaviour of the "y#" and "s#" C formats.
Related branches
- Jason Gerard DeRose: Approve
- Chad Miller: Pending requested
-
Diff: 226 lines (+70/-50)4 files modifieddbase32/_dbase32py.py (+13/-6)
dbase32/tests/__init__.py (+28/-19)
dbase32/tests/test__dbase32py.py (+12/-12)
dbase32/tests/test_rfc3548.py (+17/-13)
description: | updated |
Changed in dbase32: | |
importance: | Undecided → High |
assignee: | nobody → Jason Gerard DeRose (jderose) |
description: | updated |
description: | updated |
summary: |
- Update unit tests for Python 3.5 support + Update unit tests for Python 3.5 compatability |
Changed in dbase32: | |
status: | New → Fix Committed |
Changed in dbase32: | |
status: | Fix Committed → Fix Released |