Skip to content

Please implement the conversion of full OpenMath objects with the OMOBJ tag #30

@MarcoCostantini

Description

@MarcoCostantini

The OpenMath standard requires the OMOBJ tag, and hence, when converting from OpenMath to Python, py-openmath should accept also OpenMath objects with that tag, even if that tag is not generated when converting in the opposite direction.

Implementing the OMOBJ tag is easy, just take the child of the OMOBJ node, and call again converter.to_python applied to it.

>>> converter.to_python( decoder.decode_bytes( b'<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd"><OMI>3</OMI></OMOBJ>', snippet=True ) )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/openmath/convert.py", line 149, in to_python
    raise ValueError('Cannot convert object of class %s to Python.' % omobj.__class__.__name__)
ValueError: Cannot convert object of class OMObject to Python.
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions