-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: clean-up various tests avoiding CoW issues #55861
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,10 +217,8 @@ def test_with_datetimelikes(self): | |
|
||
def test_deepcopy(self, float_frame): | ||
cp = deepcopy(float_frame) | ||
series = cp["A"] | ||
series[:] = 10 | ||
for idx, value in series.items(): | ||
assert float_frame["A"][idx] != value | ||
cp.loc[0, "A"] = 10 | ||
assert not float_frame.equals(cp) | ||
Comment on lines
-220
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a tedious way to check that |
||
|
||
def test_inplace_return_self(self): | ||
# GH 1893 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,15 +322,15 @@ def test_set_value_by_index(self): | |
|
||
df = DataFrame(np.arange(9).reshape(3, 3).T) | ||
df.columns = list("AAA") | ||
expected = df.iloc[:, 2] | ||
expected = df.iloc[:, 2].copy() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copying those "expected" frames avoids any potential issues where |
||
|
||
with tm.assert_produces_warning(warn, match=msg): | ||
df.iloc[:, 0] = 3 | ||
tm.assert_series_equal(df.iloc[:, 2], expected) | ||
|
||
df = DataFrame(np.arange(9).reshape(3, 3).T) | ||
df.columns = [2, float(2), str(2)] | ||
expected = df.iloc[:, 1] | ||
expected = df.iloc[:, 1].copy() | ||
|
||
with tm.assert_produces_warning(warn, match=msg): | ||
df.iloc[:, 0] = 3 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why we are setting values to 0 to then check that the indexing
result
also has values of 0. Can also use a plain assert_frame_equal, which seems simpler.