Skip to content

TST: Parametrize tests in tools/test_numeric.py #21717

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 1 commit into from
Jul 3, 2018

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Jul 3, 2018

Title is self-explanatory.

@gfyoung gfyoung added Testing pandas testing functions or related to the test suite Numeric Operations Arithmetic, Comparison, and Logical operations Clean labels Jul 3, 2018
@codecov
Copy link

codecov bot commented Jul 3, 2018

Codecov Report

Merging #21717 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21717   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files         158      158           
  Lines       49703    49703           
=======================================
  Hits        45689    45689           
  Misses       4014     4014
Flag Coverage Δ
#multiple 90.3% <ø> (ø) ⬆️
#single 41.99% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f32214...3042714. Read the comment docs.

idx = pd.date_range('20130101', periods=3, tz=tz, name='xxx')
res = pd.to_numeric(idx)
tm.assert_index_equal(res, pd.Index(idx.asi8, name='xxx'))
@pytest.mark.parametrize("tz", [None, "US/Eastern", "Asia/Tokyo"])
Copy link
Member

Choose a reason for hiding this comment

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

Should the common tz_naive_fixture be used here? It has a few extra timezones, but I'm not sure if it tests anything extra/if there's a benefit to including the extra ones:

pandas/pandas/conftest.py

Lines 221 to 230 in 7cd2679

TIMEZONES = [None, 'UTC', 'US/Eastern', 'Asia/Tokyo', 'dateutil/US/Pacific']
@td.parametrize_fixture_doc(str(TIMEZONES))
@pytest.fixture(params=TIMEZONES)
def tz_naive_fixture(request):
"""
Fixture for trying timezones including default (None): {0}
"""
return request.param

Copy link
Contributor

Choose a reason for hiding this comment

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

yes ideally we re-use our fixtures as much as possible

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense to me. Done.

@jreback jreback added this to the 0.24.0 milestone Jul 3, 2018
idx = pd.date_range('20130101', periods=3, tz=tz, name='xxx')
res = pd.to_numeric(idx)
tm.assert_index_equal(res, pd.Index(idx.asi8, name='xxx'))
@pytest.mark.parametrize("tz", [None, "US/Eastern", "Asia/Tokyo"])
Copy link
Contributor

Choose a reason for hiding this comment

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

yes ideally we re-use our fixtures as much as possible

@gfyoung gfyoung force-pushed the test-numeric-parametrize branch from 6669439 to 3042714 Compare July 3, 2018 20:18
@gfyoung
Copy link
Member Author

gfyoung commented Jul 3, 2018

@jreback @jschendel : Comments addressed, and all is still green. PTAL.

@jreback jreback merged commit 0c2ab65 into pandas-dev:master Jul 3, 2018
@jreback
Copy link
Contributor

jreback commented Jul 3, 2018

thanks @gfyoung very nice!

@gfyoung gfyoung deleted the test-numeric-parametrize branch July 4, 2018 00:12
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean 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