make StringType default maximum size = 255 Bytes
Change-Id: I0c26fc24ad99ff4185ff5a0b9b8ada9a10817b8b Reviewed-on: https://forge.frm2.tum.de/review/16269 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
parent
0c63522eab
commit
3d3558ccd8
@ -260,7 +260,7 @@ class StringType(DataType):
|
|||||||
minsize = None
|
minsize = None
|
||||||
maxsize = None
|
maxsize = None
|
||||||
|
|
||||||
def __init__(self, maxsize=None, minsize=0):
|
def __init__(self, maxsize=255, minsize=0):
|
||||||
if maxsize is None:
|
if maxsize is None:
|
||||||
raise ValueError('StringType needs a maximum bytes count!')
|
raise ValueError('StringType needs a maximum bytes count!')
|
||||||
minsize, maxsize = min(minsize, maxsize), max(minsize, maxsize)
|
minsize, maxsize = min(minsize, maxsize), max(minsize, maxsize)
|
||||||
|
@ -145,8 +145,7 @@ def test_BLOBType():
|
|||||||
|
|
||||||
def test_StringType():
|
def test_StringType():
|
||||||
# test constructor catching illegal arguments
|
# test constructor catching illegal arguments
|
||||||
with pytest.raises(ValueError):
|
dt = StringType()
|
||||||
dt = StringType()
|
|
||||||
dt = StringType(12)
|
dt = StringType(12)
|
||||||
assert dt.as_json == ['string', 12]
|
assert dt.as_json == ['string', 12]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user