From 2ca325e08fcc67b099200bf40d5e355874e7e17b Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Sun, 26 Sep 2021 10:11:12 -0600 Subject: [PATCH 1/3] test: Don't use the equal_nan option of array_equal. It requires new versions of numpy --- tests/unit/test_dtypes.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_dtypes.py b/tests/unit/test_dtypes.py index 572915e..325343f 100644 --- a/tests/unit/test_dtypes.py +++ b/tests/unit/test_dtypes.py @@ -58,6 +58,11 @@ for_date_and_time = pytest.mark.parametrize("dtype", ["date", "time"]) +def eq_na(a1, a2): + nna1 = pd.notna(a1) + nna2 = pd.notna(a2) + return np.array_equal(nna1, nna2) and np.array_equal(a1[nna1], a2[nna2]) + @pytest.fixture(autouse=True) def register_dtype(): import db_dtypes # noqa @@ -575,8 +580,8 @@ def test_date_add(): dates = pd.Series(dates) times = pd.Series(times) expect = dates.astype("datetime64") + times.astype("timedelta64")[:2] - assert np.array_equal(dates + times[:2], expect, equal_nan=True) - assert np.array_equal(times[:2] + dates, expect, equal_nan=True) + assert eq_na(dates + times[:2], expect) + assert eq_na(times[:2] + dates, expect) do = pd.Series([pd.DateOffset(days=i) for i in range(4)]) expect = dates.astype("object") + do @@ -609,7 +614,7 @@ def test_date_sub(): dates = pd.Series(dates) dates2 = pd.Series(dates2) expect = dates.astype("datetime64") - dates2.astype("datetime64")[:2] - assert np.array_equal(dates - dates2[:2], expect, equal_nan=True) + assert eq_na(dates - dates2[:2], expect) do = pd.Series([pd.DateOffset(days=i) for i in range(4)]) expect = dates.astype("object") - do From fec2a2da5e64eb5e0847ece1b106823e0469f18a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sun, 26 Sep 2021 16:16:06 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- tests/unit/test_dtypes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_dtypes.py b/tests/unit/test_dtypes.py index 325343f..4991639 100644 --- a/tests/unit/test_dtypes.py +++ b/tests/unit/test_dtypes.py @@ -63,6 +63,7 @@ def eq_na(a1, a2): nna2 = pd.notna(a2) return np.array_equal(nna1, nna2) and np.array_equal(a1[nna1], a2[nna2]) + @pytest.fixture(autouse=True) def register_dtype(): import db_dtypes # noqa From 0258316705f46fc2a41c075a97bd26d9aee553fa Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Sun, 26 Sep 2021 10:19:55 -0600 Subject: [PATCH 3/3] blacken --- tests/unit/test_dtypes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_dtypes.py b/tests/unit/test_dtypes.py index 325343f..4991639 100644 --- a/tests/unit/test_dtypes.py +++ b/tests/unit/test_dtypes.py @@ -63,6 +63,7 @@ def eq_na(a1, a2): nna2 = pd.notna(a2) return np.array_equal(nna1, nna2) and np.array_equal(a1[nna1], a2[nna2]) + @pytest.fixture(autouse=True) def register_dtype(): import db_dtypes # noqa