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

TST/CLN: declass smaller test files in tests\io\excel #26764

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

simonjayhawkins
Copy link
Member

xref #26755 (review)

the larger files pandas/tests/io/excel/test_readers.py and pandas/tests/io/excel/test_writers.py have been left for separate PRs

any idiom changes other than required to declass are also omitted to make the diff easier to check.

@simonjayhawkins simonjayhawkins added Clean Testing pandas testing functions or related to the test suite labels Jun 10, 2019
@simonjayhawkins
Copy link
Member Author

@WillAyd

@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26764      +/-   ##
==========================================
- Coverage   91.71%    91.7%   -0.01%     
==========================================
  Files         178      178              
  Lines       50740    50740              
==========================================
- Hits        46538    46533       -5     
- Misses       4202     4207       +5
Flag Coverage Δ
#multiple 90.3% <ø> (ø) ⬆️
#single 41.21% <ø> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.88% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.84% <0%> (-0.11%) ⬇️

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 0f3e8e8...d9472b2. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26764      +/-   ##
==========================================
- Coverage   91.71%    91.7%   -0.01%     
==========================================
  Files         178      178              
  Lines       50740    50740              
==========================================
- Hits        46538    46533       -5     
- Misses       4202     4207       +5
Flag Coverage Δ
#multiple 90.3% <ø> (ø) ⬆️
#single 41.21% <ø> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.88% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.84% <0%> (-0.11%) ⬇️

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 0f3e8e8...d9472b2. Read the comment docs.

@jreback jreback added this to the 0.25.0 milestone Jun 10, 2019


def test_to_excel_styleconverter(ext):
from openpyxl import styles
Copy link
Contributor

Choose a reason for hiding this comment

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

can move this up

"hidden": False,
openpyxl = pytest.importorskip("openpyxl")

pytestmark = pytest.mark.parametrize("ext", ['.xlsx'])
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this just a fixture definition?

Copy link
Member Author

Choose a reason for hiding this comment

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

do we want more fixtures?

we could have a fixture and inject into all tests or we could alias this mark and decorate all tests.

this just applies the parametrisation to all tests in module automatically.

Copy link
Member

Choose a reason for hiding this comment

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

Not yet but we should probably create a write_ext fixture for use here and in the writer tests (the existing fixture is applicable to extensions that we read)

Copy link
Contributor

Choose a reason for hiding this comment

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

i just find this very opaque here (we don't use this idiom anywhere else)

Copy link
Member

Choose a reason for hiding this comment

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

Probably better done in a separate PR IMO as that will require a decent amount of updates



def test_write_cells_merge_styled(ext):
from pandas.io.formats.excel import ExcelCell
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 move imports to the top

read_workbook = openpyxl.load_workbook(path)
try:
read_worksheet = read_workbook['Sheet1']
except TypeError:
Copy link
Contributor

Choose a reason for hiding this comment

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

OT: are these still needed? (the excepts)


import pandas as pd
import pandas.util.testing as tm
from pandas.util.testing import ensure_clean

from pandas.io.excel import ExcelFile

xlrd = pytest.importorskip("xlrd")
xlwt = pytest.importorskip("xlwt")
Copy link
Member

Choose a reason for hiding this comment

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

Do we already have a file we can use that contains the content of frame? Having to include xlwt creates an unnecessary dependency in this module

"hidden": False,
openpyxl = pytest.importorskip("openpyxl")

pytestmark = pytest.mark.parametrize("ext", ['.xlsx'])
Copy link
Member

Choose a reason for hiding this comment

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

Not yet but we should probably create a write_ext fixture for use here and in the writer tests (the existing fixture is applicable to extensions that we read)

"hidden": False,
openpyxl = pytest.importorskip("openpyxl")

pytestmark = pytest.mark.parametrize("ext", ['.xlsx'])
Copy link
Member

Choose a reason for hiding this comment

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

Probably better done in a separate PR IMO as that will require a decent amount of updates

@jreback
Copy link
Contributor

jreback commented Jun 10, 2019

@simonjayhawkins these comments can be done as a followup (or make an issue) if you prefer

@simonjayhawkins
Copy link
Member Author

@simonjayhawkins these comments can be done as a followup (or make an issue) if you prefer

OK. AFK for a while now anyway.

@jreback jreback merged commit d47fc0c into pandas-dev:master Jun 10, 2019
@jreback
Copy link
Contributor

jreback commented Jun 10, 2019

thanks @simonjayhawkins

@simonjayhawkins
Copy link
Member Author

@simonjayhawkins these comments can be done as a followup (or make an issue) if you prefer

i think i'll open an issue as well, as there are comments from this and several of the recent test_excel cleanup PRs to be considered as follow-ups and it'll be easier to track.

@simonjayhawkins simonjayhawkins deleted the declass-excel branch June 11, 2019 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean 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