Python 3.9: base64.{en,de}codestring function is removed
We must use base64.{en,de}codebytes instead, which has been around for a very long time already. Change-Id: I7f4d522b4b1c32c1d338aba8076b0aa89c82181b
This commit is contained in:
parent
7a8ee2d131
commit
e6f0adcbc3
@ -142,12 +142,12 @@ class BinaryType(UserType):
|
||||
def tobasetype(self, value):
|
||||
if value is None:
|
||||
return None
|
||||
return base64.encodestring(value)
|
||||
return base64.encodebytes(value)
|
||||
|
||||
def frombasetype(self, value):
|
||||
if value is None:
|
||||
return None
|
||||
return base64.decodestring(value)
|
||||
return base64.decodebytes(value)
|
||||
|
||||
|
||||
#: The binary almost-native type
|
||||
|
@ -446,13 +446,13 @@ Value: 'v3'. Value should be one of: v., v.",
|
||||
def test_binary_to_base(self):
|
||||
import base64
|
||||
assert types.binary.tobasetype(None) is None
|
||||
expected = base64.encodestring(b'abcdef')
|
||||
expected = base64.encodebytes(b'abcdef')
|
||||
assert types.binary.tobasetype(b'abcdef') == expected
|
||||
|
||||
def test_binary_from_base(self):
|
||||
import base64
|
||||
assert types.binary.frombasetype(None) is None
|
||||
encoded = base64.encodestring(b'abcdef')
|
||||
encoded = base64.encodebytes(b'abcdef')
|
||||
assert types.binary.frombasetype(encoded) == b'abcdef'
|
||||
|
||||
def test_wsattr_weakref_datatype(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user