-
Notifications
You must be signed in to change notification settings - Fork 6
fix: address failing 2D array compliance tests in DateArray #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b48ee6d
fix: address failing compliance tests in DateArray and TimeArray
tswast 90e1573
fix min/max/median for 2D arrays
tswast 47100f5
fixes except for null contains
tswast cece518
actually use NaT as 'advertised'
tswast cc5b178
fix!: use `pandas.NaT` for missing values in dbdate and dbtime dtypes
tswast cd84754
Merge branch 'issue28-NaT' into issue28-NDArrayBacked2DTests
tswast f807c6f
Merge remote-tracking branch 'upstream/main' into issue28-NDArrayBack…
tswast cc713a8
more progress towards compliance
tswast 164101a
address errors in TestMethods
tswast 1f06c78
Merge remote-tracking branch 'upstream/main' into issue28-NDArrayBack…
tswast d9edc06
move tests
tswast cdb0d0f
add prerelease deps
tswast 804cee2
fix: address failing tests with pandas 1.5.0
tswast 3e088ac
fix owlbot config
tswast 6db3c4f
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] 10c6621
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] 83451c7
Merge branch 'issue81-pandas-1.5.0-unit-tests' of https://github.com/…
gcf-owl-bot[bot] d2e6931
document why microsecond precision is used
tswast 6023008
use correct units
tswast d85c356
add box_func tests
tswast 1f17580
typo
tswast e54050e
Merge branch 'issue81-pandas-1.5.0-unit-tests' into issue28-NDArrayBa…
tswast 432bce1
Merge branch 'main' into issue28-NDArrayBacked2DTests
tswast 8ba12f6
add unit tests
tswast f3a326c
Merge remote-tracking branch 'upstream/issue28-NDArrayBacked2DTests' …
tswast 6b49c31
Merge branch 'main' into issue28-NDArrayBacked2DTests
tswast File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
Tests for extension interface compliance, inherited from pandas. | ||
|
||
See: | ||
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/test_period.py | ||
""" | ||
|
||
import datetime | ||
|
||
import numpy | ||
from pandas.tests.extension import base | ||
import pytest | ||
|
||
from db_dtypes import DateArray | ||
|
||
# NDArrayBacked2DTests suite added in https://github.com/pandas-dev/pandas/pull/44974 | ||
pytest.importorskip("pandas", minversion="1.5.0dev") | ||
|
||
|
||
@pytest.fixture | ||
def data(): | ||
return DateArray( | ||
numpy.arange( | ||
datetime.datetime(1900, 1, 1), | ||
datetime.datetime(2099, 12, 31), | ||
datetime.timedelta(days=13), | ||
dtype="datetime64[ns]", | ||
) | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def data_missing(): | ||
return DateArray([None, datetime.date(2022, 1, 27)]) | ||
|
||
|
||
class Test2DCompat(base.NDArrayBacked2DTests): | ||
pass |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this class is only one of the base test classes you can inherit from to test compliance (and actually a class that tests functionality (2D aspect of the EA) that is currently not used in pandas).
You probably want to add the others as well (see https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/base/__init__.py for the different classes, and https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/decimal/test_decimal.py for an example that uses them)