Skip to content

Commit

Permalink
Fix Tests' AttributeError in Python 3.9 with base64.decodestring (#210)
Browse files Browse the repository at this point in the history
* Fix Tests' AttributeError in Python 3.9 with base64.decodestring

base64.decodestring is deprecated in 3.1, and has been an alias of decodebytes

* Add a news fragment
  • Loading branch information
kitchoi authored Nov 16, 2020
1 parent d334029 commit feaf620
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions apptools/persistence/tests/test_state_pickler.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ def verify(self, obj, state):
self._check_instance_and_references(obj, data)

num_attr = "numeric" if data["numeric"]["type"] == "numeric" else "ref"
decodestring = getattr(base64, "decodebytes", base64.decodestring)
junk = state_pickler.gunzip_string(
decodestring(data[num_attr]["data"])
base64.decodebytes(data[num_attr]["data"])
)
num = pickle.loads(junk)
self.assertEqual(numpy.alltrue(numpy.ravel(num == obj.numeric)), 1)
Expand Down
1 change: 1 addition & 0 deletions docs/releases/upcoming/210.test.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix AttributeError on Python 3.9 due to usage of ``base64.decodestring`` in tests (#210)

0 comments on commit feaf620

Please sign in to comment.