Skip to content

Commit

Permalink
TST: add (deprecated) test for grid properties from file
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichSuter committed Jun 4, 2024
1 parent beba95a commit a101de4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_grid3d/test_grid3d_deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def fixture_any_gridproperties(any_gridprop):
return GridProperties(props=[any_gridprop])


IFILE1 = pathlib.Path("3dgrids/reek/REEK.INIT")
GFILE1 = pathlib.Path("3dgrids/reek/REEK.EGRID")


def test_gridproperties_init_deprecations(any_gridprop):
with pytest.warns(DeprecationWarning):
GridProperties(ncol=10)
Expand Down Expand Up @@ -108,6 +112,21 @@ def test_unknown_name_deprecate(gridprop):
assert gridprop3.name == gridprop.name


def test_gridprops_from_file(testdata_path):
g = xtgeo.grid_from_file(testdata_path / GFILE1, fformat="egrid")
v1 = xtgeo.gridproperties_from_file(
testdata_path / IFILE1, fformat="init", names=["PORO", "PORV"], grid=g
)

v2 = xtgeo.GridProperties()
with pytest.warns(DeprecationWarning, match="from_file is deprecated"):
v2.from_file(
testdata_path / IFILE1, fformat="init", names=["PORO", "PORV"], grid=g
)

assert v1.generate_hash() == v2.generate_hash()


def test_gridprop_mask_warns(any_gridprop):
if version.parse(xtgeo_version) >= version.parse("4.0"):
pytest.fail(reason="mask option should be removed")
Expand Down

0 comments on commit a101de4

Please sign in to comment.