Skip to content

Commit 2e5aba1

Browse files
authored
FIX-#6984: Ensure the results of inplace operations materialize (for tests) (#6985)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent cee9b98 commit 2e5aba1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

modin/pandas/test/dataframe/test_map_metadata.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,28 +1590,20 @@ def test_transpose(data):
15901590
({"A": [1, 2, 3], "B": [400, 500, 600]}, {"B": [4, np.nan, 6]}),
15911591
],
15921592
)
1593-
@pytest.mark.parametrize(
1594-
"raise_errors", bool_arg_values, ids=arg_keys("raise_errors", bool_arg_keys)
1595-
)
1596-
def test_update(data, other_data, raise_errors):
1593+
@pytest.mark.parametrize("errors", ["raise", "ignore"])
1594+
def test_update(data, other_data, errors):
15971595
modin_df, pandas_df = create_test_dfs(data)
15981596
other_modin_df, other_pandas_df = create_test_dfs(other_data)
15991597

1600-
if raise_errors:
1601-
kwargs = {"errors": "raise"}
1602-
else:
1603-
kwargs = {}
1604-
16051598
eval_general(
16061599
modin_df,
16071600
pandas_df,
16081601
lambda df: (
1609-
df.update(other_modin_df)
1602+
df.update(other_modin_df, errors=errors)
16101603
if isinstance(df, pd.DataFrame)
1611-
else df.update(other_pandas_df)
1604+
else df.update(other_pandas_df, errors=errors)
16121605
),
16131606
__inplace__=True,
1614-
**kwargs,
16151607
)
16161608

16171609

modin/pandas/test/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,13 @@ def execute_callable(fn, inplace=False, md_kwargs={}, pd_kwargs={}):
889889
if check_exception_type is None:
890890
return None
891891
with pytest.raises(Exception) as md_e:
892-
try_cast_to_pandas(fn(modin_df, **md_kwargs)) # force materialization
892+
if inplace:
893+
_ = fn(modin_df, **md_kwargs)
894+
try_cast_to_pandas(modin_df) # force materialization
895+
else:
896+
try_cast_to_pandas(
897+
fn(modin_df, **md_kwargs)
898+
) # force materialization
893899
if check_exception_type:
894900
assert isinstance(
895901
md_e.value, type(pd_e)

0 commit comments

Comments
 (0)