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

Remove SharedItems from test_excel #26579

Merged
merged 15 commits into from
Jun 5, 2019
Merged

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented May 30, 2019

Pretty big step towards logically partitioning tests in this module - replaced SharedItems and instance attributes with fixtures. Should make subsequent test reorg easier

@simonjayhawkins

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite IO Excel read_excel, to_excel labels May 30, 2019
pandas/conftest.py Outdated Show resolved Hide resolved
def test_mixed(self, merge_cells, engine, ext):
self.mixed_frame.to_excel(self.path, 'test1')
def test_mixed(self, merge_cells, engine, ext, frame):
mixed_frame = frame.copy()
Copy link
Member Author

Choose a reason for hiding this comment

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

This was previously a global variable. I didn't convert to a fixture like the rest simply because this is the only test that uses it

frame.to_excel(self.path, 'test1',
index_label=['test'],
merge_cells=merge_cells)
df = (DataFrame(np.random.randn(10, 2)) >= 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

So as not to confuse the fixture with a local variable I changed frame to df here (and in test_*_types tests)

@WillAyd
Copy link
Member Author

WillAyd commented Jun 3, 2019

@simonjayhawkins thanks for the thorough review - definitely making this PR a lot better. Latest push I think should address your callouts

pandas/tests/io/test_excel.py Show resolved Hide resolved
pandas/tests/io/test_excel.py Show resolved Hide resolved
def test_ts_frame(self, *_):
df = tm.makeTimeDataFrame()[:5]
def test_ts_frame(self, tsframe, *_):
df = tsframe
Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than duplicating logic leveraged the fixture here

@codecov
Copy link

codecov bot commented Jun 3, 2019

Codecov Report

Merging #26579 into master will decrease coverage by 50.07%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #26579       +/-   ##
===========================================
- Coverage   91.87%    41.8%   -50.08%     
===========================================
  Files         174      174               
  Lines       50692    50692               
===========================================
- Hits        46575    21190    -25385     
- Misses       4117    29502    +25385
Flag Coverage Δ
#multiple ?
#single 41.8% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.37%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.16%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.1%) ⬇️
pandas/core/sparse/scipy_sparse.py 10.14% <0%> (-89.86%) ⬇️
pandas/core/tools/numeric.py 10.14% <0%> (-89.86%) ⬇️
... and 128 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 1013706...5d0b631. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 3, 2019

Codecov Report

Merging #26579 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26579      +/-   ##
==========================================
- Coverage   91.87%   91.86%   -0.02%     
==========================================
  Files         174      174              
  Lines       50692    50692              
==========================================
- Hits        46575    46569       -6     
- Misses       4117     4123       +6
Flag Coverage Δ
#multiple 90.4% <ø> (-0.01%) ⬇️
#single 41.78% <ø> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/util/testing.py 90.6% <0%> (-0.22%) ⬇️
pandas/core/frame.py 97% <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 1013706...199909a. Read the comment docs.

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

lgtm. @jreback

_mixed_frame['foo'] = 'bar'

@pytest.fixture
def frame(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.

great, next time around can you add some doc-strings, and/or make more meaningful names

@jreback jreback added this to the 0.25.0 milestone Jun 5, 2019
@jreback jreback merged commit e0c41f7 into pandas-dev:master Jun 5, 2019
@jreback
Copy link
Contributor

jreback commented Jun 5, 2019

thanks @WillAyd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants