Skip to content

parametrize a whole mess of tests #19785

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 3 commits into from
Feb 22, 2018
Merged

Conversation

jbrockmendel
Copy link
Member

What it says on the tin. Because this is a big diff, nothing is moved or changed other than parametrizing tests.

@codecov
Copy link

codecov bot commented Feb 20, 2018

Codecov Report

Merging #19785 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19785      +/-   ##
==========================================
+ Coverage   91.61%   91.61%   +<.01%     
==========================================
  Files         150      150              
  Lines       48887    48882       -5     
==========================================
- Hits        44786    44782       -4     
+ Misses       4101     4100       -1
Flag Coverage Δ
#multiple 89.98% <ø> (ø) ⬆️
#single 41.79% <ø> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/sparse/series.py 95.25% <0%> (-0.02%) ⬇️
pandas/core/sparse/frame.py 94.81% <0%> (ø) ⬆️
pandas/core/sparse/array.py 91.46% <0%> (+0.08%) ⬆️
pandas/core/ops.py 96.86% <0%> (+0.12%) ⬆️

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 af5e8ec...4e1ef26. Read the comment docs.

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.

looks good, just a couple of comments

@@ -381,18 +380,17 @@ def test_ns_index(self):
freq=index.freq)
self.assert_index_parameters(new_index)

def test_join_with_period_index(self):
@pytest.mark.parametrize('how', ['left', 'right', 'inner', 'outer'])
Copy link
Contributor

Choose a reason for hiding this comment

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

note to make a fixture and hence conform ordering of how

for tz in [None, 'UTC', 'US/Eastern', 'Asia/Tokyo']:
base = pd.date_range('2016-11-05', freq='H', periods=100, tz=tz)
idx = base.repeat(5)
@pytest.mark.parametrize('tz', [None, 'UTC', '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.

usual note to fixturize tz (in future)

@@ -613,42 +613,42 @@ def test_pi_ops(self):
exp = pd.Index([0, -1, -2, -3], name='idx')
tm.assert_index_equal(result, exp)

def test_pi_ops_errors(self):
@pytest.mark.parametrize('ng', ["str", 1.5])
def test_pi_ops_errors(self, ng):
idx = PeriodIndex(['2011-01', '2011-02', '2011-03', '2011-04'],
freq='M', name='idx')
ser = pd.Series(idx)

msg = r"unsupported operand type\(s\)"

for obj in [idx, ser]:
Copy link
Contributor

Choose a reason for hiding this comment

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

still need this loop here?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are a bunch of borderline cases like this left for the next pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

thats fine

assert p.tz == exp.tz

def test_timestamp_tz_arg_dateutil(self):
@pytest.mark.parametrize('case', ['Europe/Brussels',
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to tz

assert p.tz == exp_zone.tzinfo
assert p.tz == exp.tz

@pytest.mark.parametrize('case', ['dateutil/Europe/Brussels',
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Member Author

Choose a reason for hiding this comment

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

There's already a tz variable in the method; case is the name used for this in the status quo.

Copy link
Contributor

Choose a reason for hiding this comment

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

pls change. this is really confusing.

@jreback jreback added Testing pandas testing functions or related to the test suite Datetime Datetime data dtype Timedelta Timedelta data type labels Feb 20, 2018
@jreback jreback added this to the 0.23.0 milestone Feb 22, 2018
@jreback jreback merged commit b945247 into pandas-dev:master Feb 22, 2018
@jreback
Copy link
Contributor

jreback commented Feb 22, 2018

thanks. pls add to the list to move the common fixtures to a higher level (e.g. tz, dtypes)

harisbal pushed a commit to harisbal/pandas that referenced this pull request Feb 28, 2018
@jbrockmendel jbrockmendel deleted the more_tests branch June 22, 2018 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants