Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Nov 25, 2023
1 parent 1f3d62e commit 11d6216
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,7 @@ def use_inf_as_na_cb(key) -> None:
"copy_on_write",
# Get the default from an environment variable, if set, otherwise defaults
# to False. This environment variable can be set for testing.
"warn"
if os.environ.get("PANDAS_COPY_ON_WRITE", "0") == "warn"
else os.environ.get("PANDAS_COPY_ON_WRITE", "0") == "1",
"warn",
copy_on_write_doc,
validator=is_one_of_factory([True, False, "warn"]),
)
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/apply/test_invalid_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_transform_axis_1_raises():
Series([1]).transform("sum", axis=1)


def test_apply_modify_traceback():
def test_apply_modify_traceback(warn_copy_on_write):
data = DataFrame(
{
"A": [
Expand Down Expand Up @@ -206,7 +206,8 @@ def transform(row):

msg = "'float' object has no attribute 'startswith'"
with pytest.raises(AttributeError, match=msg):
data.apply(transform, axis=1)
with tm.assert_cow_warning(warn_copy_on_write):
data.apply(transform, axis=1)


@pytest.mark.parametrize(
Expand Down

0 comments on commit 11d6216

Please sign in to comment.