bytes column explicitly only accepts bytes now
This commit is contained in:
@@ -222,11 +222,11 @@ class Blob(Column):
|
||||
raise Exception("expecting a binary, got a %s" % type(value))
|
||||
|
||||
val = super(Bytes, self).to_database(value)
|
||||
return six.b(val)
|
||||
return bytearray(val)
|
||||
|
||||
def to_python(self, value):
|
||||
#return value[2:].decode('hex')
|
||||
return six.u(value)
|
||||
return value
|
||||
|
||||
Bytes = Blob
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from uuid import uuid1, uuid4, UUID
|
||||
import six
|
||||
|
||||
from cqlengine.tests.base import BaseCassEngTestCase
|
||||
|
||||
@@ -80,9 +81,9 @@ class BaseColumnIOTest(BaseCassEngTestCase):
|
||||
|
||||
class TestBlobIO(BaseColumnIOTest):
|
||||
|
||||
column = columns.Bytes
|
||||
pkey_val = 'blake', uuid4().bytes
|
||||
data_val = 'eggleston', uuid4().bytes
|
||||
column = columns.Blob
|
||||
pkey_val = six.b('blake'), uuid4().bytes
|
||||
data_val = six.b('eggleston'), uuid4().bytes
|
||||
|
||||
class TestTextIO(BaseColumnIOTest):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user