Skip to content

Commit

Permalink
Fix pandas formatting for a few minor versions only
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Sep 27, 2023
1 parent 48dc205 commit 5df78c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from swn.compat import ignore_shapely_warnings_for_object_array


PANDAS_MAJOR_VERSION = int(pd.__version__[0:pd.__version__.index(".")])
PANDAS_VESRSION_TUPLE = tuple(int(x) for x in re.findall(r"\d+", pd.__version__))

datadir = Path("tests") / "data"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import swn

from .conftest import PANDAS_MAJOR_VERSION, datadir
from .conftest import PANDAS_VESRSION_TUPLE, datadir


# same valid network used in test_basic
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_read_write_formatted_frame(tmp_path):
lines = fname.read_text().splitlines()
assert len(lines) == 7
# check first line, space between object columns differ between versions!
if PANDAS_MAJOR_VERSION >= 2:
if (2, 0, 0) <= PANDAS_VESRSION_TUPLE <= (2, 0, 2):
expected = "# value1 value2 value3"
else:
expected = "# value1 value2 value3"
Expand Down

0 comments on commit 5df78c5

Please sign in to comment.