Skip to content

Commit 8bad59d

Browse files
committed
Specify UTF-8 encoding when opening files
Added explicit encoding="utf-8" to file open calls in omex.py and test_legacy.py to ensure consistent file reading across different environments.
1 parent f8b4d08 commit 8bad59d

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

pyenzyme/sbml/omex.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,7 @@ def read_sbml_omex(path: Path | str) -> tuple[TextIO, dict[str, pd.DataFrame]]:
184184

185185
meas_data[entry.location] = df
186186

187-
return open(omex.get_path(master_file.location)), meas_data
187+
return open(
188+
omex.get_path(master_file.location),
189+
encoding="utf-8",
190+
), meas_data

tests/integration/test_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_legacy(self):
1616
consistent and expected output for legacy OMEX files.
1717
"""
1818
enzmldoc = EnzymeMLDocument.fromFile("tests/fixtures/sbml/v1_example.omex")
19-
expected = open("tests/fixtures/sbml/v1_sbml.xml", "r").read()
19+
expected = open("tests/fixtures/sbml/v1_sbml.xml", "r", encoding="utf-8").read()
2020
actual = enzmldoc.toXMLString()
2121

2222
assert actual == expected

0 commit comments

Comments
 (0)