Skip to content

Commit c0e2896

Browse files
BUG: Add tests and edit docs for #63112
1 parent 0a3846f commit c0e2896

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ Other
13261326
^^^^^
13271327
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
13281328
- Bug in :class:`Series` ignoring errors when trying to convert :class:`Series` input data to the given ``dtype`` (:issue:`60728`)
1329+
- Bug in :func:`array` where it did not always raise an error when the passed data was not like 1D. (:issue:`63112`)
13291330
- Bug in :func:`eval` on :class:`ExtensionArray` on including division ``/`` failed with a ``TypeError``. (:issue:`58748`)
13301331
- Bug in :func:`eval` where method calls on binary operations like ``(x + y).dropna()`` would raise ``AttributeError: 'BinOp' object has no attribute 'value'`` (:issue:`61175`)
13311332
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)

pandas/tests/arrays/test_array.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,21 @@ def test_nd_raises(data):
460460
pd.array(data, dtype="int64")
461461

462462

463-
@pytest.mark.parametrize("data", [[["a"], ["b"]]])
463+
@pytest.mark.parametrize(
464+
"data",
465+
[
466+
# string 2D
467+
[["a"], ["b"]],
468+
# int 2D
469+
[[1], [2]],
470+
# float 2D
471+
[[1.0], [2.0]],
472+
# mixed 2D
473+
[[1, 2], ["a", "b"]],
474+
# mixed 3D
475+
[[[1]], [["a"]], [[3.14]]],
476+
],
477+
)
464478
def test_not_1D_like_raises(data):
465479
with pytest.raises(TypeError, match="Values must be a 1D list-like"):
466480
pd.array(data, dtype=pd.StringDtype())

0 commit comments

Comments
 (0)