From 4e5a35e49d32eef66516dcfab3427c9433084faf Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Thu, 15 Dec 2022 13:36:41 +0000 Subject: [PATCH] Backport PR #50268: CI new numpy nightly failing some tests --- pandas/tests/series/methods/test_describe.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandas/tests/series/methods/test_describe.py b/pandas/tests/series/methods/test_describe.py index a7cedd580b2d0..56bd9341d2efe 100644 --- a/pandas/tests/series/methods/test_describe.py +++ b/pandas/tests/series/methods/test_describe.py @@ -1,4 +1,7 @@ import numpy as np +import pytest + +from pandas.compat import is_numpy_dev from pandas.core.dtypes.common import ( is_complex_dtype, @@ -163,6 +166,12 @@ def test_numeric_result_dtype(self, any_numeric_dtype): dtype = "complex128" if is_complex_dtype(any_numeric_dtype) else None ser = Series([0, 1], dtype=any_numeric_dtype) + if dtype == "complex128" and is_numpy_dev: + with pytest.raises( + TypeError, match=r"^a must be an array of real numbers$" + ): + ser.describe() + return result = ser.describe() expected = Series( [