-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Clean up DataFrame.to_csv compression tests #19273
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
Conversation
pandas/tests/frame/test_to_csv.py
Outdated
for col in df.columns: | ||
assert col in text | ||
@pytest.mark.parametrize('compression', [ | ||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if you want to take this one step further, you can make compression a fixture (put it in pandas.tests.conftest) the top-level one, then you can simply use the compression arg and it will just work.
pandas/tests/frame/test_to_csv.py
Outdated
import bz2 | ||
f = bz2.BZ2File(filename, 'rb') | ||
# explicitly make sure file is compressed | ||
f = tm.decompress_file(filename, compression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also change decompress_file to be a contextmanger so you can do
with tm.decompress_file(filename, compress) as fh:
......
c08fa82
to
6b911c8
Compare
Hello @reidy-p! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on January 20, 2018 at 11:31 Hours UTC |
6b911c8
to
2f44f8a
Compare
looks very nice. not passing though :< ping on green. |
@jreback the failing tests seem to be caused by the following lines of code which have a pandas/pandas/tests/io/parser/test_network.py Lines 16 to 26 in f0cd23c
Do you want to try to combine this into the new |
so best would be to fix that |
98d5943
to
c499344
Compare
c499344
to
8077702
Compare
Codecov Report
@@ Coverage Diff @@
## master #19273 +/- ##
=======================================
Coverage 91.53% 91.53%
=======================================
Files 150 150
Lines 48739 48739
=======================================
Hits 44612 44612
Misses 4127 4127
Continue to review full report at Codecov.
|
@jreback it’s green now. I just changed the argument name for now but I will continue with cleaning the compression tests. |
thanks @reidy-p keep em coming! |
Why does this add a new |
import pandas.util._test_decorators as td | ||
|
||
|
||
@pytest.fixture(params=[None, 'gzip', 'bz2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reidy-p yeah move this 1 level high in next PR (it’s already there just add the contents)
Sure. Thanks @jorisvandenbossche |
xref #19226
Parametrized some of the compression tests in
tests/frame/test_to_csv.py
and used the newdecompress_file
function.