Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discontinue deprecated methods #275

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/fmu/sumo/explorer/objects/polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ def __init__(self, sumo: SumoClient, metadata: Dict) -> None:
"""
super().__init__(sumo, metadata)

def to_dataframe(self) -> pd.DataFrame:
"""Get polygons object as a DataFrame

Returns:
DataFrame: A DataFrame object
"""
warn(
".to_dataframe() is deprecated, renamed to .to_pandas() ",
DeprecationWarning,
stacklevel=2,
)

return self.to_pandas()

def to_pandas(self) -> pd.DataFrame:
"""Get polygons object as a DataFrame

Expand Down
29 changes: 0 additions & 29 deletions src/fmu/sumo/explorer/objects/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ def __init__(self, sumo: SumoClient, metadata: dict) -> None:
self._arrowtable = None
self._logger = logging.getLogger("__name__" + ".Table")

@property
def dataframe(self) -> pd.DataFrame:
"""Return object as a pandas DataFrame

Returns:
DataFrame: A DataFrame object
"""
warn(
".dataframe is deprecated, renamed to .to_pandas",
DeprecationWarning,
stacklevel=2,
)
return self.to_pandas()


def to_pandas(self) -> pd.DataFrame:
"""Return object as a pandas DataFrame
Expand Down Expand Up @@ -107,21 +93,6 @@ async def to_pandas_async(self) -> pd.DataFrame:
return self._dataframe


@property
def arrowtable(self) -> pa.Table:
"""Return object as an arrow Table

Returns:
pa.Table: _description_
"""
warn(
".arrowtable is deprecated, renamed to .to_arrow",
DeprecationWarning,
stacklevel=2,
)

return self.to_arrow()

def to_arrow(self) -> pa.Table:
"""Return object as an arrow Table

Expand Down
35 changes: 0 additions & 35 deletions tests/test_objects_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,11 @@ def fixture_table(case):

### Table

def test_table_dataframe(table):
"""Test the dataframe property."""
with pytest.warns(DeprecationWarning, match=".dataframe is deprecated"):
df = table.dataframe
assert isinstance(df, pd.DataFrame)


def test_table_to_pandas(table):
"""Test the to_pandas method."""
df = table.to_pandas()
assert isinstance(df, pd.DataFrame)


def test_arrowtable(table):
"""Test the arrowtable property."""
with pytest.warns(DeprecationWarning, match=".arrowtable is deprecated"):
arrow = table.arrowtable
assert isinstance(arrow, pa.Table)


def test_table_to_arrow(table):
"""Test the to_arrow() method"""
arrow = table.to_arrow()
Expand All @@ -74,26 +59,6 @@ def test_aggregated_summary_arrow(case):
)


def test_aggregated_summary_arrow_with_deprecated_function_name(case):
"""Test usage of Aggregated class with default type with deprecated function name"""

table = AggregatedTable(case, "summary", "eclipse", "iter-0")

assert len(table.columns) == 972 + 2
column = table["FOPT"]

with pytest.warns(
DeprecationWarning,
match=".arrowtable is deprecated, renamed to .to_arrow()",
):
assert isinstance(column.arrowtable, pa.Table)
with pytest.raises(IndexError) as e_info:
table = table["banana"]
assert (
e_info.value.args[0] == "Column: 'banana' does not exist try again"
)


def test_aggregated_summary_pandas(case):
"""Test usage of Aggregated class with item_type=pandas"""
table = AggregatedTable(case, "summary", "eclipse", "iter-0")
Expand Down