Skip to content

Commit b48ee6d

Browse files
committed
fix: address failing compliance tests in DateArray and TimeArray
test: add a test session with prerelease versions of dependencies
1 parent e9d41d1 commit b48ee6d

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/unit/test_date_compliance.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""
15+
Tests for extension interface compliance, inherited from pandas.
16+
17+
See:
18+
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/test_period.py
19+
"""
20+
21+
import datetime
22+
23+
import numpy
24+
from pandas.tests.extension import base
25+
import pytest
26+
27+
from db_dtypes import DateArray
28+
29+
# NDArrayBacked2DTests suite added in https://github.com/pandas-dev/pandas/pull/44974
30+
pytest.importorskip("pandas", minversion="1.5.0dev")
31+
32+
33+
@pytest.fixture
34+
def data():
35+
return DateArray(
36+
numpy.arange(
37+
datetime.datetime(1900, 1, 1),
38+
datetime.datetime(2099, 12, 31),
39+
datetime.timedelta(days=13),
40+
dtype="datetime64[ns]",
41+
)
42+
)
43+
44+
45+
@pytest.fixture
46+
def data_missing():
47+
return DateArray([None, datetime.date(2022, 1, 27)])
48+
49+
50+
class Test2DCompat(base.NDArrayBacked2DTests):
51+
pass

0 commit comments

Comments
 (0)