diff --git a/tests/test_grid3d/test_grid3d_deprecations.py b/tests/test_grid3d/test_grid3d_deprecations.py index 793214b7c..9077c1d84 100644 --- a/tests/test_grid3d/test_grid3d_deprecations.py +++ b/tests/test_grid3d/test_grid3d_deprecations.py @@ -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) @@ -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")