Skip to content

TST: Parameterize some compression tests #20337

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 2 commits into from
Mar 16, 2018

Conversation

reidy-p
Copy link
Contributor

@reidy-p reidy-p commented Mar 13, 2018

closes #19226

Parameterizing some tests in pandas/tests/io/parser/compression.py. I left the zip test alone because it was quite different to the others and I couldn't see an easy way to incorporate it in the parameterizing.

path, compression='bz3')
if compress_type == 'bz2':
pytest.raises(ValueError, self.read_csv,
path, compression='bz3')
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the reason it's 'bz3' and not 'bz2' is that it's supposed to raise a ValueError

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh ok

Copy link
Contributor

@jreback jreback Mar 13, 2018

Choose a reason for hiding this comment

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

hmm i would put that testing of the error condition in a separate test

Copy link
Contributor

Choose a reason for hiding this comment

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

actually on 2nd thought, this is ok.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 13, 2018
@jreback jreback added this to the 0.23.0 milestone Mar 13, 2018
@jreback
Copy link
Contributor

jreback commented Mar 13, 2018

ping on green.

@@ -12,6 +12,10 @@
import pandas.util.testing as tm
import pandas.util._test_decorators as td

import gzip
import bz2
lzma = compat.import_lzma()
Copy link
Contributor

Choose a reason for hiding this comment

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

this is slightly annoying you have to skip that test if can't import lzma but you need the file reference

Traceback:
pandas/tests/io/parser/test_parsers.py:23: in <module>
    from .compression import CompressionTests
pandas/tests/io/parser/compression.py:17: in <module>
    lzma = compat.import_lzma()
pandas/compat/__init__.py:346: in import_lzma
    from backports import lzma
E   ImportError: cannot import name lzma

you might be able to do a

try:
    lzma = compat.import_lzma()
except ImportError:
    lzma = None

then change the below to

getattr(lzma, 'LZMAFile', None)

any other ideas @WillAyd

@reidy-p reidy-p force-pushed the clean_parser_compression branch from effae7b to 3a6fd0d Compare March 15, 2018 21:38
@codecov
Copy link

codecov bot commented Mar 15, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20337      +/-   ##
==========================================
- Coverage   91.77%   91.73%   -0.05%     
==========================================
  Files         152      150       -2     
  Lines       49196    49151      -45     
==========================================
- Hits        45151    45090      -61     
- Misses       4045     4061      +16
Flag Coverage Δ
#multiple 90.12% <ø> (-0.05%) ⬇️
#single 41.9% <ø> (+0.08%) ⬆️
Impacted Files Coverage Δ
pandas/io/html.py 86.6% <0%> (-2.19%) ⬇️
pandas/io/formats/format.py 96.26% <0%> (-1.99%) ⬇️
pandas/plotting/_converter.py 65.07% <0%> (-1.74%) ⬇️
pandas/core/algorithms.py 94.17% <0%> (-0.13%) ⬇️
pandas/compat/__init__.py 57.62% <0%> (-0.12%) ⬇️
pandas/core/arrays/categorical.py 95.06% <0%> (-0.06%) ⬇️
pandas/core/ops.py 96.35% <0%> (ø) ⬆️
pandas/core/strings.py 98.32% <0%> (ø) ⬆️
pandas/core/indexing.py 93.02% <0%> (ø) ⬆️
pandas/errors/__init__.py 92.3% <0%> (ø) ⬆️
... and 16 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 30e0006...3a6fd0d. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 15, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #20337   +/-   ##
=======================================
  Coverage   91.77%   91.77%           
=======================================
  Files         152      152           
  Lines       49196    49196           
=======================================
  Hits        45151    45151           
  Misses       4045     4045
Flag Coverage Δ
#multiple 90.16% <ø> (ø) ⬆️
#single 41.82% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/frame.py 97.18% <0%> (ø) ⬆️
pandas/core/generic.py 95.85% <0%> (ø) ⬆️

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 30e0006...3a6fd0d. Read the comment docs.

@reidy-p
Copy link
Contributor Author

reidy-p commented Mar 16, 2018

@jreback your suggestion worked so I think this is ready. Thanks!

@jreback jreback merged commit 30d712f into pandas-dev:master Mar 16, 2018
@jreback
Copy link
Contributor

jreback commented Mar 16, 2018

thanks!

@reidy-p reidy-p deleted the clean_parser_compression branch March 17, 2018 23:01
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.

TST: clean up all of the compression tests
2 participants