You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In test_id_bug.py I create a fragment of the SBML specification in modelspec, whereby the id field has to be defined as optional as per the spec doc
whenever an object that gets stored in a list is not assigned an id this triggers a KeyError when trying to convert to json using modelspec/base_types.py:to_json_file (presumably because the id is trying to be used as the key for a dictionary where the other attributes of the object are going to be stored)
'''
sbml_doc = SBML(id=sbml_id) #no error if id is None
model = Model(id=model_id) #no error if id is None
sbml_doc.model = model
unitDef = UnitDefinition(id=unitdef_id) #ERROR if id is None
model.listOfUnitDefinitions.append(unitDef)
unit = Unit(id=unit_id)#Error if id is None
unitDef.listOfUnits.append(unit)
#this triggers the error
sbml_doc.to_json_file(f"untracked/test_id_bug.{fname}.json")
'''
The text was updated successfully, but these errors were encountered:
It is not yet clear if we need to use the special (for modelspec) attribute name 'id' and work around this bug, or if my current workaround of using the attribute 'sid' in place of 'id' (which prevents this bug from triggering) will be better. It will come down to how the serialisation to XML is implemented.
using sid as a workaround is implemented in test_sid_fix.py and is being used in the main spec file sbml32spec.py
Uh oh!
There was an error while loading. Please reload this page.
see test_id_bug.py
andtest_sid_fix.py
In test_id_bug.py I create a fragment of the SBML specification in modelspec, whereby the id field has to be defined as optional as per the spec doc
whenever an object that gets stored in a list is not assigned an id this triggers a KeyError when trying to convert to json using modelspec/base_types.py:to_json_file (presumably because the id is trying to be used as the key for a dictionary where the other attributes of the object are going to be stored)
'''
sbml_doc = SBML(id=sbml_id) #no error if id is None
'''
The text was updated successfully, but these errors were encountered: