Skip to content
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

unit tests fail against pandas 1.5.0 (prerelease) #81

Closed
tswast opened this issue Mar 16, 2022 · 2 comments · Fixed by #82
Closed

unit tests fail against pandas 1.5.0 (prerelease) #81

tswast opened this issue Mar 16, 2022 · 2 comments · Fixed by #82
Assignees
Labels
api: bigquery Issues related to the googleapis/python-db-dtypes-pandas API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tswast
Copy link
Collaborator

tswast commented Mar 16, 2022

(dev-3.9) ➜  python-db-dtypes-pandas git:(issue28-NDArrayBacked2DTests) ✗ nox -s unit_prerelease
nox > Running session unit_prerelease
nox > Creating virtual environment (virtualenv) using python3.10 in .nox/unit_prerelease
nox > python -m pip install --extra-index-url https://pypi.fury.io/arrow-nightlies/ --prefer-binary --pre --upgrade pyarrow
nox > python -m pip install --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple --prefer-binary --pre --upgrade pandas
nox > python -m pip install mock asyncmock pytest pytest-cov pytest-asyncio -c /Users/swast/src/github.com/googleapis/python-db-dtypes-pandas/testing/constraints-3.10.txt
nox > python -m pip install packaging pandas pyarrow numpy
nox > python -m pip install --no-deps -e .
nox > python -m pip freeze
asyncmock==0.4.2
attrs==21.4.0
coverage==6.3.2
-e git+ssh://git@github.com/googleapis/python-db-dtypes-pandas.git@d9edc063393c4431cb8622106c7999afea5f8532#egg=db_dtypes
iniconfig==1.1.1
mock==4.0.3
numpy==1.22.3
packaging==21.3
pandas==1.5.0.dev0+526.g48d515958d
pluggy==1.0.0
py==1.11.0
pyarrow==8.0.0.dev229
pyparsing==3.0.7
pytest==7.1.0
pytest-asyncio==0.18.2
pytest-cov==3.0.0
python-dateutil==2.8.2
pytz==2021.3
six==1.16.0
tomli==2.0.1
nox > py.test --quiet --junitxml=prerelease_unit_3.10_sponge_log.xml --cov=db_dtypes --cov=tests/unit --cov-append --cov-config=.coveragerc --cov-report= --cov-fail-under=0 tests/unit
......................................................................................................................... [ 49%]
......FF................................................................................................................. [ 98%]
....                                                                                                                      [100%]
=========================================================== FAILURES ============================================================
_________________________________________________ test__from_factorized[dbdate] _________________________________________________

dtype = 'dbdate'

    @for_date_and_time
    def test__from_factorized(dtype):
        sample_values = SAMPLE_VALUES[dtype]
        a = _cls(dtype)(sample_values * 2)
>       codes, b = a.factorize()

tests/unit/test_dtypes.py:296: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox/unit_prerelease/lib/python3.10/site-packages/pandas/core/arrays/base.py:1044: in factorize
    arr, na_value = self._values_for_factorize()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateArray>
[datetime.date(2021, 2, 2), datetime.date(2021, 2, 3),
 datetime.date(2021, 2, 4), datetime.date(2021, 2, ...2021, 2, 2), datetime.date(2021, 2, 3),
 datetime.date(2021, 2, 4), datetime.date(2021, 2, 5)]
Length: 8, dtype: dbdate

    def _values_for_factorize(self):
>       return self._ndarray, self._internal_fill_value
E       AttributeError: 'DateArray' object has no attribute '_internal_fill_value'

.nox/unit_prerelease/lib/python3.10/site-packages/pandas/core/arrays/_mixins.py:194: AttributeError
_________________________________________________ test__from_factorized[dbtime] _________________________________________________

dtype = 'dbtime'

    @for_date_and_time
    def test__from_factorized(dtype):
        sample_values = SAMPLE_VALUES[dtype]
        a = _cls(dtype)(sample_values * 2)
>       codes, b = a.factorize()

tests/unit/test_dtypes.py:296: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox/unit_prerelease/lib/python3.10/site-packages/pandas/core/arrays/base.py:1044: in factorize
    arr, na_value = self._values_for_factorize()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TimeArray>
[        datetime.time(1, 2, 2), datetime.time(1, 2, 3, 500000),
 datetime.time(1, 2, 4, 500000), datetime...tetime.time(1, 2, 3, 500000),
 datetime.time(1, 2, 4, 500000), datetime.time(1, 2, 5, 500000)]
Length: 8, dtype: dbtime

    def _values_for_factorize(self):
>       return self._ndarray, self._internal_fill_value
E       AttributeError: 'TimeArray' object has no attribute '_internal_fill_value'

.nox/unit_prerelease/lib/python3.10/site-packages/pandas/core/arrays/_mixins.py:194: AttributeError
======================================================= warnings summary ========================================================
.nox/unit_prerelease/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191
  /Users/swast/src/github.com/googleapis/python-db-dtypes-pandas/.nox/unit_prerelease/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
    config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---- generated xml file: /Users/swast/src/github.com/googleapis/python-db-dtypes-pandas/prerelease_unit_3.10_sponge_log.xml -----


==================================================== short test summary info ====================================================
FAILED tests/unit/test_dtypes.py::test__from_factorized[dbdate] - AttributeError: 'DateArray' object has no attribute '_intern...
FAILED tests/unit/test_dtypes.py::test__from_factorized[dbtime] - AttributeError: 'TimeArray' object has no attribute '_intern...
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-db-dtypes-pandas API. label Mar 16, 2022
@tswast
Copy link
Collaborator Author

tswast commented Mar 16, 2022

Hmmm... Not able to reproduce on GitHub actions. https://github.com/googleapis/python-db-dtypes-pandas/runs/5573008751?check_suite_focus=true

Maybe something specific to the macOS build?

@tswast
Copy link
Collaborator Author

tswast commented Mar 16, 2022

Looks like this _internal_fill_value attribute was added in pandas-dev/pandas#46110

Does appear that we need to populate it, probably with NaT.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 17, 2022
@tswast tswast self-assigned this Mar 17, 2022
@meredithslota meredithslota added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Mar 17, 2022
gcf-merge-on-green bot pushed a commit that referenced this issue Mar 18, 2022
test: add a test session with prerelease versions of dependencies

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-db-dtypes-pandas/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #81  🦕
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-db-dtypes-pandas API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants