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 52667ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions swn/modflow/_swnmf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,14 @@ def write_package_period(
>>> fname_01 = dir / "model_drn_01.dat"
>>> nm.write_package_period("drn", fname_tpl, auxiliary="dlen")
>>> print(fname_01.read_text(), end="")
#k i j elev cond dlen boundname
1 1 1 10.0 15.0 18.028 101
1 1 2 10.0 15.0 6.009 101
1 2 2 10.0 15.0 12.019 101
1 1 2 10.0 15.0 21.082 102
1 2 2 10.0 15.0 10.541 102
1 2 2 10.0 15.0 10.000 100
1 3 2 10.0 15.0 10.000 100
#k i j elev cond dlen boundname
1 1 1 10.0 15.0 18.028 101
1 1 2 10.0 15.0 6.009 101
1 2 2 10.0 15.0 12.019 101
1 1 2 10.0 15.0 21.082 102
1 2 2 10.0 15.0 10.541 102
1 2 2 10.0 15.0 10.000 100
1 3 2 10.0 15.0 10.000 100
>>> drn = nm.set_package_obj(
... "drn", pname="swn_drn", auxmultname="dlen",
... stress_period_data={0: {"filename": fname_01.name}})
Expand Down
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 52667ea

Please sign in to comment.