Skip to content

Commit d436dbd

Browse files
dsaxtonKevin D Smith
authored and
Kevin D Smith
committed
CI: Add unwanted pattern check (pandas-dev#37298)
1 parent a7658d1 commit d436dbd

File tree

119 files changed

+1522
-1619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+1522
-1619
lines changed

ci/code_checks.sh

+2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
205205
MSG='Check for inconsistent use of pandas namespace in tests' ; echo $MSG
206206
check_namespace "Series"
207207
RET=$(($RET + $?))
208+
check_namespace "DataFrame"
209+
RET=$(($RET + $?))
208210
echo $MSG "DONE"
209211
fi
210212

pandas/tests/arithmetic/test_timedelta64.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,14 @@ def test_timedelta_ops_with_missing_values(self):
722722

723723
sn = pd.to_timedelta(Series([pd.NaT], dtype="m8[ns]"))
724724

725-
df1 = pd.DataFrame(["00:00:01"]).apply(pd.to_timedelta)
726-
df2 = pd.DataFrame(["00:00:02"]).apply(pd.to_timedelta)
725+
df1 = DataFrame(["00:00:01"]).apply(pd.to_timedelta)
726+
df2 = DataFrame(["00:00:02"]).apply(pd.to_timedelta)
727727
with pytest.raises(TypeError, match=msg):
728728
# Passing datetime64-dtype data to TimedeltaIndex is no longer
729729
# supported GH#29794
730-
pd.DataFrame([pd.NaT]).apply(pd.to_timedelta)
730+
DataFrame([pd.NaT]).apply(pd.to_timedelta)
731731

732-
dfn = pd.DataFrame([pd.NaT.value]).apply(pd.to_timedelta)
732+
dfn = DataFrame([pd.NaT.value]).apply(pd.to_timedelta)
733733

734734
scalar1 = pd.to_timedelta("00:00:01")
735735
scalar2 = pd.to_timedelta("00:00:02")

pandas/tests/computation/test_eval.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def test_unary_in_array(self):
667667
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
668668
def test_float_comparison_bin_op(self, dtype):
669669
# GH 16363
670-
df = pd.DataFrame({"x": np.array([0], dtype=dtype)})
670+
df = DataFrame({"x": np.array([0], dtype=dtype)})
671671
res = df.eval("x < -0.1")
672672
assert res.values == np.array([False])
673673

@@ -734,7 +734,7 @@ def test_float_truncation(self):
734734
expected = np.float64(exp)
735735
assert result == expected
736736

737-
df = pd.DataFrame({"A": [1000000000.0009, 1000000000.0011, 1000000000.0015]})
737+
df = DataFrame({"A": [1000000000.0009, 1000000000.0011, 1000000000.0015]})
738738
cutoff = 1000000000.0006
739739
result = df.query(f"A < {cutoff:.4f}")
740740
assert result.empty
@@ -751,12 +751,12 @@ def test_float_truncation(self):
751751

752752
def test_disallow_python_keywords(self):
753753
# GH 18221
754-
df = pd.DataFrame([[0, 0, 0]], columns=["foo", "bar", "class"])
754+
df = DataFrame([[0, 0, 0]], columns=["foo", "bar", "class"])
755755
msg = "Python keyword not valid identifier in numexpr query"
756756
with pytest.raises(SyntaxError, match=msg):
757757
df.query("class == 0")
758758

759-
df = pd.DataFrame()
759+
df = DataFrame()
760760
df.index.name = "lambda"
761761
with pytest.raises(SyntaxError, match=msg):
762762
df.query("lambda == 0")
@@ -1366,7 +1366,7 @@ def assignment_not_inplace(self):
13661366

13671367
def test_multi_line_expression(self):
13681368
# GH 11149
1369-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1369+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
13701370
expected = df.copy()
13711371

13721372
expected["c"] = expected["a"] + expected["b"]
@@ -1403,7 +1403,7 @@ def test_multi_line_expression(self):
14031403

14041404
def test_multi_line_expression_not_inplace(self):
14051405
# GH 11149
1406-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1406+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14071407
expected = df.copy()
14081408

14091409
expected["c"] = expected["a"] + expected["b"]
@@ -1428,7 +1428,7 @@ def test_multi_line_expression_not_inplace(self):
14281428

14291429
def test_multi_line_expression_local_variable(self):
14301430
# GH 15342
1431-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1431+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14321432
expected = df.copy()
14331433

14341434
local_var = 7
@@ -1446,7 +1446,7 @@ def test_multi_line_expression_local_variable(self):
14461446

14471447
def test_multi_line_expression_callable_local_variable(self):
14481448
# 26426
1449-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1449+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14501450

14511451
def local_func(a, b):
14521452
return b
@@ -1466,7 +1466,7 @@ def local_func(a, b):
14661466

14671467
def test_multi_line_expression_callable_local_variable_with_kwargs(self):
14681468
# 26426
1469-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1469+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14701470

14711471
def local_func(a, b):
14721472
return b
@@ -1486,7 +1486,7 @@ def local_func(a, b):
14861486

14871487
def test_assignment_in_query(self):
14881488
# GH 8664
1489-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1489+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14901490
df_orig = df.copy()
14911491
msg = "cannot assign without a target object"
14921492
with pytest.raises(ValueError, match=msg):
@@ -1495,7 +1495,7 @@ def test_assignment_in_query(self):
14951495

14961496
def test_query_inplace(self):
14971497
# see gh-11149
1498-
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
1498+
df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
14991499
expected = df.copy()
15001500
expected = expected[expected["a"] == 2]
15011501
df.query("a == 2", inplace=True)
@@ -2052,7 +2052,7 @@ def test_truediv_deprecated(engine, parser):
20522052

20532053

20542054
def test_negate_lt_eq_le(engine, parser):
2055-
df = pd.DataFrame([[0, 10], [1, 20]], columns=["cat", "count"])
2055+
df = DataFrame([[0, 10], [1, 20]], columns=["cat", "count"])
20562056
expected = df[~(df.cat > 0)]
20572057

20582058
result = df.query("~(cat > 0)", engine=engine, parser=parser)

0 commit comments

Comments
 (0)