It was also considered whether lxml could be used. lxml would have
been able to supply additional information, such as line numbers of
element definitions. However, lxml has compatibility issues with
the way namespaces are handled in the sbml module currently.
The tests that rely on inline XML data were modified. On Python 2.7,
cElementTree only works with a file that reads
bytes. StringIO returns unicode if initialized with a unicode
string. This results in cElementTree failing if a unicode
string is supplied in test cases (or if unicode_literals is set).
Instead use BytesIO with a string explicitly encoded as UTF-8.
This works in all cases.
It was also considered whether lxml could be used. lxml would have been able to supply additional information, such as line numbers of element definitions. However, lxml has compatibility issues with the way namespaces are handled in the sbml module currently.
The tests that rely on inline XML data were modified. On Python 2.7, cElementTree only works with a file that reads bytes. StringIO returns unicode if initialized with a unicode string. This results in cElementTree failing if a unicode string is supplied in test cases (or if unicode_literals is set). Instead use BytesIO with a string explicitly encoded as UTF-8. This works in all cases.