Skip to content

Commit d7825aa

Browse files
committed
exclude array
1 parent 8df5034 commit d7825aa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pandas/tests/frame/test_constructors.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
)
3434
import pandas._testing as tm
3535
from pandas.arrays import IntervalArray, PeriodArray, SparseArray
36-
from pandas.core.construction import array as pd_array
3736

3837
MIXED_FLOAT_DTYPES = ["float16", "float32", "float64"]
3938
MIXED_INT_DTYPES = [
@@ -754,7 +753,7 @@ def test_constructor_extension_scalar_data(self, data, dtype):
754753
assert df["a"].dtype == dtype
755754
assert df["b"].dtype == dtype
756755

757-
arr = pd_array([data] * 2, dtype=dtype)
756+
arr = pd.array([data] * 2, dtype=dtype)
758757
expected = DataFrame({"a": arr, "b": arr})
759758

760759
tm.assert_frame_equal(df, expected)

scripts/check_for_inconsistent_pandas_namespace.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323

2424
ERROR_MESSAGE = "Found both `pd.{name}` and `{name}` in {path}"
2525
EXCLUDE = {
26+
"array", # `import array` and `pd.array` should both be allowed
27+
"eval", # built-in, different from `pd.eval`
2628
"np", # pd.np is deprecated but still tested
27-
"eval",
2829
}
2930

3031

@@ -68,11 +69,10 @@ def check_for_inconsistent_pandas_namespace(
6869
and visitor.pandas_namespace[i.offset] in visitor.no_namespace
6970
):
7071
if not replace:
71-
raise RuntimeError(
72-
ERROR_MESSAGE.format(
73-
name=visitor.pandas_namespace[i.offset], path=path
74-
)
72+
msg = ERROR_MESSAGE.format(
73+
name=visitor.pandas_namespace[i.offset], path=path
7574
)
75+
raise RuntimeError(msg)
7676
# Replace `pd`
7777
tokens[n] = i._replace(src="")
7878
# Replace `.`

0 commit comments

Comments
 (0)