• Maxime Puys's avatar
    Removed duplicate code from XML parser (#376) · 2f95353a
    Maxime Puys authored
    * Added: handling of Byte, SByte and DateTime convertion from ua to python
    
    * log nodeid in addressspace
    
    * Updated: Removed some duplicate xml parsing.
    
    _parse_value was parsing the child of a node as a constant.
    Making it parse a node directly and not its child allows recursive calls
    to parse ListOf elements.
    _parse_containted_value as been added as a wrapper to obtain former
    behavior.
    Now ua_type_to_python is simply a wrapper to ua_utils.string_to_val and
    _to_bool a wrapper to ua_type_to_python.
    All value parsing is performed by ua_utils.string_to_value.
    Missing types have been listed as FIXME.
    
    * Added: tests for XML parsing.
    
    Added some tests in tests/tests_xml.py for datatype DateTime (+list),
    QualifiedName (+list), ListOfGuid and ListOfExtensionObjects.
    Few tweaks in xmlimporter: (i) DateTime is now parsed in string_to_val
    and double parsing was causing an error, (ii) single Guid were converted
    to UUID while lists were not by default list case.
    Another possibility would be either to make the conversion to UUID in xmlparser
    or to make the _add_variable_value also recursive but I'm not sure of
    other possible consequences.
    Finaly it seems according to specs that all DateTime should be timezone
    aware so I forced UTC when a timezone was not precised.
    Maybe an exception should be raised?
    
    * Added: pytz in requirements
    
    * Added: pytz in travis requirements
    
    * Added: pytz in travis requirements
    2f95353a
tests_xml.py 13.8 KB