Skip to content

TST: parametrize/de-duplicate arithmetic tests #44962

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 8 commits into from
Dec 19, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

@jreback jreback added Numeric Operations Arithmetic, Comparison, and Logical operations Testing pandas testing functions or related to the test suite labels Dec 19, 2021
@jreback jreback modified the milestones: 2.0, 1.4 Dec 19, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm some commments for followup

with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
# The constructor validation can lead to a DeprecationWarning
# from numpy, e.g. with RangeIndex + np.datetime64("now")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm shouldn't we do something about this? (e.g. cast to object)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, turns out to be pretty easy, will handle before long

for scalar in [pd.offsets.Hour(5), np.timedelta64(5, "h"), timedelta(hours=5)]:
offset = dates + scalar
tm.assert_equal(offset, expected)
offset = scalar + dates
tm.assert_equal(offset, expected)

roundtrip = offset - scalar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob should split this to a separate test & parameterize (followup)

@jreback jreback merged commit ff16cdb into pandas-dev:master Dec 19, 2021
@jbrockmendel jbrockmendel deleted the tst-arith branch December 19, 2021 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants