Skip to content

Fixturize tests/frame/test_indexing.py #25633

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 10 commits into from
Jun 28, 2019

Conversation

h-vetinari
Copy link
Contributor

One more step towards #22471. Happy to move the fixture to the test_indexing module if that's now the preferred form.

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.

see comments. I don't really like to have multiple fixtures injected that are used in parts of tests. its just plain confusing (I know we let some thru before, but let's not do that anymore)

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 10, 2019
Copy link
Contributor Author

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Reflecting the points happening across several of these PRs, I'll:

@codecov
Copy link

codecov bot commented Mar 10, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #25633   +/-   ##
=======================================
  Coverage   91.26%   91.26%           
=======================================
  Files         173      173           
  Lines       52968    52968           
=======================================
  Hits        48339    48339           
  Misses       4629     4629
Flag Coverage Δ
#multiple 89.83% <ø> (ø) ⬆️
#single 41.71% <ø> (ø) ⬆️

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 df771cc...ddc1d44. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 10, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25633      +/-   ##
==========================================
+ Coverage   91.84%   91.85%   +<.01%     
==========================================
  Files         180      174       -6     
  Lines       50734    50722      -12     
==========================================
- Hits        46599    46589      -10     
+ Misses       4135     4133       -2
Flag Coverage Δ
#multiple 90.39% <ø> (-0.09%) ⬇️
#single 41.78% <ø> (-0.18%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_misc.py 38.23% <0%> (-26.63%) ⬇️
pandas/io/gbq.py 78.94% <0%> (-21.06%) ⬇️
pandas/io/gcs.py 80% <0%> (-20%) ⬇️
pandas/io/s3.py 89.47% <0%> (-10.53%) ⬇️
pandas/core/groupby/base.py 91.83% <0%> (-8.17%) ⬇️
pandas/plotting/_core.py 83.77% <0%> (-5.61%) ⬇️
pandas/io/excel/_xlrd.py 94.54% <0%> (-5.46%) ⬇️
pandas/io/clipboard/clipboards.py 31.64% <0%> (-3.14%) ⬇️
pandas/io/excel/_util.py 87.32% <0%> (-2.68%) ⬇️
pandas/core/internals/managers.py 93.87% <0%> (-2.34%) ⬇️
... and 93 more

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 de0867f...4e48d44. Read the comment docs.

@h-vetinari
Copy link
Contributor Author

@jreback
Split up the test and it's green.

@@ -127,6 +127,17 @@ def timezone_frame():
return df


@pytest.fixture
def uint64_frame():
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of this can you just use the mixed_int_frame (maybe even add a column to it if needed)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, not changing the semantics of tests here. Just translating.

piece = self.frame.loc[self.frame.index[:2], ['A', 'B']]
self.frame.loc[self.frame.index[-2]:, ['A', 'B']] = piece.values
result = self.frame.loc[self.frame.index[-2:], ['A', 'B']].values
def test_setitem_frame(self, float_frame, float_string_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

parametrize or split test

Copy link
Contributor

Choose a reason for hiding this comment

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

ok with splitting this test

assert result == expected

def test_lookup(self):
def test_lookup(self, float_frame, float_string_frame):
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
Contributor

Choose a reason for hiding this comment

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

same, see if you can split the test

Copy link
Contributor Author

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

@jreback
You always insist on keeping PRs focused on one thing. Please don't try to force changing tests in a PR that is strictly for translation.

If you want to split tests, I'll do it as simply as possible (barring someone showing me some fixture magic that I'm not aware of).

@@ -127,6 +127,17 @@ def timezone_frame():
return df


@pytest.fixture
def uint64_frame():
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, not changing the semantics of tests here. Just translating.

@h-vetinari
Copy link
Contributor Author

@jreback
Any suggestions how you would implement that fixturization you want?

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.

frame/test_indexing.py is actually pretty huge. so pls change according to my comments, and open an issue to split this to separate smaller files (after)

piece = self.frame.loc[self.frame.index[:2], ['A', 'B']]
self.frame.loc[self.frame.index[-2]:, ['A', 'B']] = piece.values
result = self.frame.loc[self.frame.index[-2:], ['A', 'B']].values
def test_setitem_frame(self, float_frame, float_string_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

ok with splitting this test

assert result == expected

def test_lookup(self):
def test_lookup(self, float_frame, float_string_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

same, see if you can split the test

@jreback
Copy link
Contributor

jreback commented Apr 20, 2019

this one might be ok, merge master and ping on green.

@jreback
Copy link
Contributor

jreback commented May 12, 2019

closing as stale

@jreback jreback closed this May 12, 2019
@h-vetinari
Copy link
Contributor Author

@jreback

Sorry, I overlooked the request to merge master (busy times last month). Please reopen and I'll happily update.

@simonjayhawkins
Copy link
Member

@h-vetinari can you merge master

Conflicting files
pandas/tests/frame/test_indexing.py

@h-vetinari
Copy link
Contributor Author

@simonjayhawkins Thanks for reopening; merged master.

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.

anyplace you are adding multiple fixtures should have the tests splits; there are only a couple and shouldn't be a big deal to do

@@ -1329,15 +1331,15 @@ def test_getitem_fancy_1d(self):
# slice of mixed-frame
Copy link
Contributor

Choose a reason for hiding this comment

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

can you split this test

def test_xs(self):
idx = self.frame.index[5]
xs = self.frame.xs(idx)
def test_xs(self, float_frame, datetime_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you split

@@ -2582,7 +2593,8 @@ def test_boolean_indexing_mixed(self):
with pytest.raises(TypeError, match=msg):
df[df > 0.3] = 1

def test_where(self):
def test_where(self, float_string_frame, mixed_float_frame,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you split

@jreback
Copy link
Contributor

jreback commented Jun 27, 2019

pls merge master and will look again

@jreback jreback added this to the 0.25.0 milestone Jun 27, 2019
@h-vetinari
Copy link
Contributor Author

Thanks for taking care of this!

@simonjayhawkins simonjayhawkins mentioned this pull request Jun 28, 2019
6 tasks
@jreback jreback merged commit a65b2e3 into pandas-dev:master Jun 28, 2019
@jreback
Copy link
Contributor

jreback commented Jun 28, 2019

thanks @h-vetinari

@h-vetinari h-vetinari deleted the fixturize_frame_indexing branch June 28, 2019 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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