Open
Description
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
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")
'''
Metadata
Assignees
Labels
No labels
Activity