change again SECoP datatype syntax

- change from single element JSON-object to flattened JSON-object
  with 'type' key.
- rename of some data properties (maxbytes, maxchars, maxlen)
- added isUTF8 to StringType
The rename of the SECoP property 'datatype' to 'datainfo' will
follow in an other change.

Change-Id: I7a75f0d025ff476dd19385db3487f18c4c746bcf
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21293
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2019-09-24 08:54:16 +02:00
parent 6acc82d808
commit 596353e09a
3 changed files with 233 additions and 230 deletions

View File

@ -36,18 +36,18 @@ def test_Command():
assert cmd.ctr
assert cmd.argument is None
assert cmd.result is None
assert cmd.for_export() == {u'datatype': {u'command': {}},
assert cmd.for_export() == {u'datatype': {'type': 'command'},
u'description': u'do_something'}
cmd = Command(u'do_something', argument=IntRange(-9,9), result=IntRange(-1,1))
assert cmd.description
assert isinstance(cmd.argument, IntRange)
assert isinstance(cmd.result, IntRange)
assert cmd.for_export() == {u'datatype': {u'command': {u'argument': {u'int': {u'min':-9, u'max':9}},
u'result': {u'int': {u'min':-1, u'max':1}}}},
assert cmd.for_export() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'min':-9, 'max':9},
u'result': {'type': 'int', 'min':-1, 'max':1}},
u'description': u'do_something'}
assert cmd.exportProperties() == {u'datatype': {u'command': {u'argument': {u'int': {u'max': 9, u'min': -9}},
u'result': {u'int': {u'max': 1, u'min': -1}}}},
assert cmd.exportProperties() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'max': 9, 'min': -9},
'result': {'type': 'int', 'max': 1, 'min': -1}},
u'description': u'do_something'}