Skip to content

Remove Unnecessary Subclasses from test_excel #26553

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 4 commits into from
May 30, 2019

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented May 29, 2019

More cleanup...

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite IO Excel read_excel, to_excel Clean labels May 29, 2019
@pytest.mark.parametrize("merge_cells,ext,engine", [
(None, '.xlsx', 'openpyxl')])
class TestOpenpyxlTests(_WriterBase):
@pytest.mark.parametrize("ext", ['.xlsx'])
Copy link
Member Author

Choose a reason for hiding this comment

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

Only one test in each of these classes was actually using the engine parameter so figured cleaner to just specify there

Copy link
Member Author

Choose a reason for hiding this comment

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

merge_cells was also never used but rather required due to the mix of pytest / subclassing paradigms; I've done away with it entirely here

@@ -591,7 +591,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
def __new__(cls, path, engine=None, **kwargs):
# only switch class if generic(ExcelWriter)

if issubclass(cls, ExcelWriter):
if cls is ExcelWriter:
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 isn't a user-facing bug but trying to import any of the ExcelWriter subclasses would exhibit rather surprising behavior which causes a test failure when getting rid of the subclassing. For instance:

>>> from pandas.io.excel._openpyxl import _OpenpyxlWriter
>>> writer = _OpenpyxlWriter('foo.xlsx')
>>> type(writer)
<class 'pandas.io.excel._xlsxwriter._XlsxWriter'>

From the comment directly preceding this it appears this condition was backwards, so changed as such

@codecov
Copy link

codecov bot commented May 29, 2019

Codecov Report

Merging #26553 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26553      +/-   ##
==========================================
- Coverage   91.77%   91.76%   -0.01%     
==========================================
  Files         174      174              
  Lines       50649    50649              
==========================================
- Hits        46483    46479       -4     
- Misses       4166     4170       +4
Flag Coverage Δ
#multiple 90.3% <100%> (ø) ⬆️
#single 41.69% <0%> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/io/excel/_base.py 91.81% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
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 e7ad884...39e4d4e. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented May 29, 2019

Codecov Report

Merging #26553 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26553      +/-   ##
==========================================
- Coverage   91.77%   91.76%   -0.01%     
==========================================
  Files         174      174              
  Lines       50649    50649              
==========================================
- Hits        46483    46479       -4     
- Misses       4166     4170       +4
Flag Coverage Δ
#multiple 90.3% <100%> (ø) ⬆️
#single 41.69% <0%> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/io/excel/_base.py 91.81% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
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 e7ad884...39e4d4e. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented May 30, 2019

@WillAyd you have the other excel test PR; this lgtm. so merge if going to be a conflict (or rebase this after)

@WillAyd WillAyd added this to the 0.25.0 milestone May 30, 2019
@WillAyd WillAyd merged commit 8154efb into pandas-dev:master May 30, 2019
@WillAyd WillAyd deleted the remove-test-subclasses branch May 30, 2019 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean 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.

2 participants