Skip to content

Commit 3cf05ed

Browse files
authored
STYLE: Extending codespell to pandas/tests (#40320)
* STYLE: Extending codespell to pandas/tests part 1 * FIX: Variable name made consistent.
1 parent c10dd1a commit 3cf05ed

22 files changed

+55
-53
lines changed

pandas/tests/arithmetic/test_timedelta64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ def test_td64arr_add_sub_int(self, box_with_array, one):
11581158
msg = "Addition/subtraction of integers"
11591159
assert_invalid_addsub_type(tdarr, one, msg)
11601160

1161-
# TOOD: get inplace ops into assert_invalid_addsub_type
1161+
# TODO: get inplace ops into assert_invalid_addsub_type
11621162
with pytest.raises(TypeError, match=msg):
11631163
tdarr += one
11641164
with pytest.raises(TypeError, match=msg):

pandas/tests/arrays/categorical/test_missing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ def test_fillna_array(self):
107107
other = cat.fillna("C")
108108
result = cat.fillna(other)
109109
tm.assert_categorical_equal(result, other)
110-
assert isna(cat[-1]) # didnt modify original inplace
110+
assert isna(cat[-1]) # didn't modify original inplace
111111

112112
other = np.array(["A", "B", "C", "B", "A"])
113113
result = cat.fillna(other)
114114
expected = Categorical(["A", "B", "C", "B", "A"], dtype=cat.dtype)
115115
tm.assert_categorical_equal(result, expected)
116-
assert isna(cat[-1]) # didnt modify original inplace
116+
assert isna(cat[-1]) # didn't modify original inplace
117117

118118
@pytest.mark.parametrize(
119119
"values, expected",

pandas/tests/arrays/sparse/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_constructor_na_dtype(self, dtype):
9595
SparseArray([0, 1, np.nan], dtype=dtype)
9696

9797
def test_constructor_warns_when_losing_timezone(self):
98-
# GH#32501 warn when losing timezone inforamtion
98+
# GH#32501 warn when losing timezone information
9999
dti = pd.date_range("2016-01-01", periods=3, tz="US/Pacific")
100100

101101
expected = SparseArray(np.asarray(dti, dtype="datetime64[ns]"))

pandas/tests/computation/test_eval.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,11 @@ def test_performance_warning_for_poor_alignment(self, engine, parser):
11441144
if not is_python_engine:
11451145
assert len(w) == 1
11461146
msg = str(w[0].message)
1147-
loged = np.log10(s.size - df.shape[1])
1147+
logged = np.log10(s.size - df.shape[1])
11481148
expected = (
11491149
f"Alignment difference on axis 1 is larger "
11501150
f"than an order of magnitude on term 'df', "
1151-
f"by more than {loged:.4g}; performance may suffer"
1151+
f"by more than {logged:.4g}; performance may suffer"
11521152
)
11531153
assert msg == expected
11541154

@@ -1404,25 +1404,25 @@ def test_multi_line_expression(self):
14041404

14051405
expected["c"] = expected["a"] + expected["b"]
14061406
expected["d"] = expected["c"] + expected["b"]
1407-
ans = df.eval(
1407+
answer = df.eval(
14081408
"""
14091409
c = a + b
14101410
d = c + b""",
14111411
inplace=True,
14121412
)
14131413
tm.assert_frame_equal(expected, df)
1414-
assert ans is None
1414+
assert answer is None
14151415

14161416
expected["a"] = expected["a"] - 1
14171417
expected["e"] = expected["a"] + 2
1418-
ans = df.eval(
1418+
answer = df.eval(
14191419
"""
14201420
a = a - 1
14211421
e = a + 2""",
14221422
inplace=True,
14231423
)
14241424
tm.assert_frame_equal(expected, df)
1425-
assert ans is None
1425+
assert answer is None
14261426

14271427
# multi-line not valid if not all assignments
14281428
msg = "Multi-line expressions are only valid if all expressions contain"
@@ -1467,15 +1467,15 @@ def test_multi_line_expression_local_variable(self):
14671467
local_var = 7
14681468
expected["c"] = expected["a"] * local_var
14691469
expected["d"] = expected["c"] + local_var
1470-
ans = df.eval(
1470+
answer = df.eval(
14711471
"""
14721472
c = a * @local_var
14731473
d = c + @local_var
14741474
""",
14751475
inplace=True,
14761476
)
14771477
tm.assert_frame_equal(expected, df)
1478-
assert ans is None
1478+
assert answer is None
14791479

14801480
def test_multi_line_expression_callable_local_variable(self):
14811481
# 26426
@@ -1487,15 +1487,15 @@ def local_func(a, b):
14871487
expected = df.copy()
14881488
expected["c"] = expected["a"] * local_func(1, 7)
14891489
expected["d"] = expected["c"] + local_func(1, 7)
1490-
ans = df.eval(
1490+
answer = df.eval(
14911491
"""
14921492
c = a * @local_func(1, 7)
14931493
d = c + @local_func(1, 7)
14941494
""",
14951495
inplace=True,
14961496
)
14971497
tm.assert_frame_equal(expected, df)
1498-
assert ans is None
1498+
assert answer is None
14991499

15001500
def test_multi_line_expression_callable_local_variable_with_kwargs(self):
15011501
# 26426
@@ -1507,15 +1507,15 @@ def local_func(a, b):
15071507
expected = df.copy()
15081508
expected["c"] = expected["a"] * local_func(b=7, a=1)
15091509
expected["d"] = expected["c"] + local_func(b=7, a=1)
1510-
ans = df.eval(
1510+
answer = df.eval(
15111511
"""
15121512
c = a * @local_func(b=7, a=1)
15131513
d = c + @local_func(b=7, a=1)
15141514
""",
15151515
inplace=True,
15161516
)
15171517
tm.assert_frame_equal(expected, df)
1518-
assert ans is None
1518+
assert answer is None
15191519

15201520
def test_assignment_in_query(self):
15211521
# GH 8664

pandas/tests/config/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def test_describe_option(self):
112112

113113
# if no doc is specified we get a default message
114114
# saying "description not available"
115-
assert "vailable" in self.cf.describe_option("f", _print_desc=False)
116-
assert "vailable" in self.cf.describe_option("g.h", _print_desc=False)
115+
assert "available" in self.cf.describe_option("f", _print_desc=False)
116+
assert "available" in self.cf.describe_option("g.h", _print_desc=False)
117117
assert "precated" in self.cf.describe_option("g.h", _print_desc=False)
118118
assert "k" in self.cf.describe_option("g.h", _print_desc=False)
119119

pandas/tests/dtypes/cast/test_promote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _assert_match(result_fill_value, expected_fill_value):
103103

104104
if hasattr(result_fill_value, "dtype"):
105105
# Compare types in a way that is robust to platform-specific
106-
# idiosyncracies where e.g. sometimes we get "ulonglong" as an alias
106+
# idiosyncrasies where e.g. sometimes we get "ulonglong" as an alias
107107
# for "uint64" or "intc" as an alias for "int32"
108108
assert result_fill_value.dtype.kind == expected_fill_value.dtype.kind
109109
assert result_fill_value.dtype.itemsize == expected_fill_value.dtype.itemsize

pandas/tests/dtypes/test_missing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def test_array_equivalent_nested():
553553
)
554554
def test_na_value_for_dtype(dtype, na_value):
555555
result = na_value_for_dtype(dtype)
556-
# identify check doesnt work for datetime64/timedelta64("NaT") bc they
556+
# identify check doesn't work for datetime64/timedelta64("NaT") bc they
557557
# are not singletons
558558
assert result is na_value or (
559559
isna(result) and isna(na_value) and type(result) is type(na_value)

pandas/tests/extension/base/dim2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def test_reductions_2d_axis1(self, data, method, request):
238238
else:
239239
raise AssertionError("Both reductions should raise or neither")
240240

241-
# not necesarrily type/dtype-preserving, so weaker assertions
241+
# not necessarily type/dtype-preserving, so weaker assertions
242242
assert result.shape == (1,)
243243
expected_scalar = getattr(data, method)()
244244
if pd.isna(result[0]):

pandas/tests/extension/base/methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_argmin_argmax(self, data_for_sorting, data_missing_for_sorting, na_valu
9090
assert data_for_sorting.argmax() == 1
9191
assert data_for_sorting.argmin() == 2
9292

93-
# with repeated values -> first occurence
93+
# with repeated values -> first occurrence
9494
data = data_for_sorting.take([2, 0, 0, 1, 1, 2])
9595
assert data.argmax() == 3
9696
assert data.argmin() == 0
@@ -109,7 +109,7 @@ def test_argmin_argmax_empty_array(self, method, data):
109109

110110
@pytest.mark.parametrize("method", ["argmax", "argmin"])
111111
def test_argmin_argmax_all_na(self, method, data, na_value):
112-
# all missing with skipna=True is the same as emtpy
112+
# all missing with skipna=True is the same as empty
113113
err_msg = "attempt to get"
114114
data_na = type(data)._from_sequence([na_value, na_value], dtype=data.dtype)
115115
with pytest.raises(ValueError, match=err_msg):
@@ -530,7 +530,7 @@ def test_equals(self, data, na_value, as_series, box):
530530
# different length
531531
assert data[:2].equals(data[:3]) is False
532532

533-
# emtpy are equal
533+
# empty are equal
534534
assert data[:0].equals(data[:0]) is True
535535

536536
# other types

pandas/tests/extension/test_boolean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_argmin_argmax(self, data_for_sorting, data_missing_for_sorting):
234234
assert data_for_sorting.argmax() == 0
235235
assert data_for_sorting.argmin() == 2
236236

237-
# with repeated values -> first occurence
237+
# with repeated values -> first occurrence
238238
data = data_for_sorting.take([2, 0, 0, 1, 1, 2])
239239
assert data.argmax() == 1
240240
assert data.argmin() == 0

0 commit comments

Comments
 (0)