Skip to content

Commit 9903a54

Browse files
authored
STYLE: Extending codespell to pandas/tests Part 2 (#40332)
* STYLE: Extending codespell to pandas/tests part 2 * DOC: small change in test_setitem.py
1 parent bfefa19 commit 9903a54

23 files changed

+44
-44
lines changed

pandas/tests/frame/indexing/test_indexing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ def test_setitem_corner(self, float_frame):
439439
dm["foo"] = "bar"
440440
assert dm["foo"].dtype == np.object_
441441

442-
dm["coercable"] = ["1", "2", "3"]
443-
assert dm["coercable"].dtype == np.object_
442+
dm["coercible"] = ["1", "2", "3"]
443+
assert dm["coercible"].dtype == np.object_
444444

445445
def test_setitem_corner2(self):
446446
data = {

pandas/tests/frame/indexing/test_setitem.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def test_setitem_intervals(self):
420420
assert isinstance(ser.cat.categories, IntervalIndex)
421421

422422
# B & D end up as Categoricals
423-
# the remainer are converted to in-line objects
423+
# the remainder are converted to in-line objects
424424
# containing an IntervalIndex.values
425425
df["B"] = ser
426426
df["C"] = np.array(ser)
@@ -433,13 +433,13 @@ def test_setitem_intervals(self):
433433
assert is_categorical_dtype(df["D"].dtype)
434434
assert is_interval_dtype(df["D"].cat.categories)
435435

436-
# Thes goes through the Series constructor and so get inferred back
436+
# These go through the Series constructor and so get inferred back
437437
# to IntervalDtype
438438
assert is_interval_dtype(df["C"])
439439
assert is_interval_dtype(df["E"])
440440

441441
# But the Series constructor doesn't do inference on Series objects,
442-
# so setting df["F"] doesnt get cast back to IntervalDtype
442+
# so setting df["F"] doesn't get cast back to IntervalDtype
443443
assert is_object_dtype(df["F"])
444444

445445
# they compare equal as Index

pandas/tests/frame/methods/test_cov_corr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_corr_item_cache(self, using_array_manager):
207207

208208
_ = df.corr()
209209

210-
# Check that the corr didnt break link between ser and df
210+
# Check that the corr didn't break link between ser and df
211211
ser.values[0] = 99
212212
assert df.loc[0, "A"] == 99
213213
assert df["A"] is ser

pandas/tests/frame/methods/test_quantile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,11 @@ class TestQuantileExtensionDtype:
550550
pd.date_range("2016-01-01", periods=9, tz="US/Pacific"),
551551
pytest.param(
552552
pd.array(np.arange(9), dtype="Int64"),
553-
marks=pytest.mark.xfail(reason="doesnt implement from_factorized"),
553+
marks=pytest.mark.xfail(reason="doesn't implement from_factorized"),
554554
),
555555
pytest.param(
556556
pd.array(np.arange(9), dtype="Float64"),
557-
marks=pytest.mark.xfail(reason="doesnt implement from_factorized"),
557+
marks=pytest.mark.xfail(reason="doesn't implement from_factorized"),
558558
),
559559
],
560560
ids=lambda x: str(x.dtype),

pandas/tests/frame/methods/test_replace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,8 @@ def test_categorical_replace_with_dict(self, replace_dict, final_data):
14391439

14401440
a = pd.Categorical(final_data[:, 0], categories=[3, 2])
14411441

1442-
excat = [3, 2] if replace_dict["b"] == 1 else [1, 3]
1443-
b = pd.Categorical(final_data[:, 1], categories=excat)
1442+
ex_cat = [3, 2] if replace_dict["b"] == 1 else [1, 3]
1443+
b = pd.Categorical(final_data[:, 1], categories=ex_cat)
14441444

14451445
expected = DataFrame({"a": a, "b": b})
14461446
result = df.replace(replace_dict, 3)

pandas/tests/frame/methods/test_reset_index.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def test_reset_index(self, float_frame):
137137

138138
# preserve column names
139139
float_frame.columns.name = "columns"
140-
resetted = float_frame.reset_index()
141-
assert resetted.columns.name == "columns"
140+
reset = float_frame.reset_index()
141+
assert reset.columns.name == "columns"
142142

143143
# only remove certain columns
144144
df = float_frame.reset_index().set_index(["index", "A", "B"])
@@ -159,10 +159,10 @@ def test_reset_index(self, float_frame):
159159

160160
# test resetting in place
161161
df = float_frame.copy()
162-
resetted = float_frame.reset_index()
162+
reset = float_frame.reset_index()
163163
return_value = df.reset_index(inplace=True)
164164
assert return_value is None
165-
tm.assert_frame_equal(df, resetted, check_names=False)
165+
tm.assert_frame_equal(df, reset, check_names=False)
166166

167167
df = float_frame.reset_index().set_index(["index", "A", "B"])
168168
rs = df.reset_index("A", drop=True)
@@ -224,11 +224,11 @@ def test_reset_index_right_dtype(self):
224224
)
225225
df = DataFrame(s1)
226226

227-
resetted = s1.reset_index()
228-
assert resetted["time"].dtype == np.float64
227+
reset = s1.reset_index()
228+
assert reset["time"].dtype == np.float64
229229

230-
resetted = df.reset_index()
231-
assert resetted["time"].dtype == np.float64
230+
reset = df.reset_index()
231+
assert reset["time"].dtype == np.float64
232232

233233
def test_reset_index_multiindex_col(self):
234234
vals = np.random.randn(3, 3).astype(object)

pandas/tests/frame/methods/test_to_dict_of_blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_to_dict_of_blocks_item_cache():
5353

5454
df._to_dict_of_blocks()
5555

56-
# Check that the to_dict_of_blocks didnt break link between ser and df
56+
# Check that the to_dict_of_blocks didn't break link between ser and df
5757
ser.values[0] = "foo"
5858
assert df.loc[0, "b"] == "foo"
5959

pandas/tests/frame/methods/test_values.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_frame_values_with_tz(self):
9191
)
9292
tm.assert_numpy_array_equal(result, expected)
9393

94-
# two columns, homogenous
94+
# two columns, homogeneous
9595

9696
df["B"] = df["A"]
9797
result = df.values

pandas/tests/frame/test_subclass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def test_subclassed_apply(self):
519519
def check_row_subclass(row):
520520
assert isinstance(row, tm.SubclassedSeries)
521521

522-
def strech(row):
522+
def stretch(row):
523523
if row["variable"] == "height":
524524
row["value"] += 0.5
525525
return row
@@ -547,7 +547,7 @@ def strech(row):
547547
columns=["first", "last", "variable", "value"],
548548
)
549549

550-
result = df.apply(lambda x: strech(x), axis=1)
550+
result = df.apply(lambda x: stretch(x), axis=1)
551551
assert isinstance(result, tm.SubclassedDataFrame)
552552
tm.assert_frame_equal(result, expected)
553553

pandas/tests/groupby/aggregate/test_aggregate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ def test_agg_relabel_multiindex_column(
758758

759759

760760
def test_agg_relabel_multiindex_raises_not_exist():
761-
# GH 29422, add test for raises senario when aggregate column does not exist
761+
# GH 29422, add test for raises scenario when aggregate column does not exist
762762
df = DataFrame(
763763
{"group": ["a", "a", "b", "b"], "A": [0, 1, 2, 3], "B": [5, 6, 7, 8]}
764764
)
@@ -769,7 +769,7 @@ def test_agg_relabel_multiindex_raises_not_exist():
769769

770770

771771
def test_agg_relabel_multiindex_duplicates():
772-
# GH29422, add test for raises senario when getting duplicates
772+
# GH29422, add test for raises scenario when getting duplicates
773773
# GH28426, after this change, duplicates should also work if the relabelling is
774774
# different
775775
df = DataFrame(

0 commit comments

Comments
 (0)