Skip to content

TST: Avoid DeprecationWarnings #22646

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
Sep 12, 2018
Merged

Conversation

jbrockmendel
Copy link
Member

Avoid a boatload of these:

pandas/tests/plotting/test_frame.py::TestDataFramePlots::()::test_plot
  /home/travis/build/pandas-dev/pandas/pandas/core/indexes/multi.py:1556: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
    if lab[key] == -1:

  /home/travis/build/pandas-dev/pandas/pandas/io/formats/style.py:1039: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
    return css_bar(min(x, zero), max(x, zero), colors[x > zero])

pandas/tests/series/test_analytics.py::TestCategoricalSeriesAnalytics::()::test_drop_duplicates_categorical_non_bool[False-datetime64[D]]
  source:2442: DeprecationWarning: invalid escape sequence \(

That last one was a nice little adventure tracking down to pd.util.testing.

Does not silence these, as I'm not confident that is The Right Thing To Do:

pandas/tests/tslibs/test_parsing.py::TestGuessDatetimeFormat::()::test_guess_datetime_format_nopadding[2011-1-1 0:0:0-%Y-%m-%d %H:%M:%S]
  /home/travis/miniconda3/envs/pandas/lib/python3.6/site-packages/dateutil/parser/__init__.py:46: DeprecationWarning: _timelex is a private class and may break without warning, it will be moved and or renamed in future versions.
    warnings.warn(msg, DeprecationWarning)

Does not silence these, as I'm not sure how:

pandas/tests/io/test_sql.py::TestSQLiteAlchemyConn::()::test_read_table
  /home/travis/miniconda3/envs/pandas/lib/python3.6/site-packages/_pytest/fixtures.py:795: RemovedInPytest4Warning: Fixture setup_method called directly. Fixtures are not meant to be called directly, are created automatically when test functions request them as parameters. See https://docs.pytest.org/en/latest/fixture.html for more information.
    res = next(it)

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

file_to_check.py:2442:-258: W605 invalid escape sequence '('
file_to_check.py:2442:-255: W605 invalid escape sequence ')'


@codecov
Copy link

codecov bot commented Sep 9, 2018

Codecov Report

Merging #22646 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22646      +/-   ##
==========================================
+ Coverage   92.17%   92.17%   +<.01%     
==========================================
  Files         169      169              
  Lines       50708    50715       +7     
==========================================
+ Hits        46740    46747       +7     
  Misses       3968     3968
Flag Coverage Δ
#multiple 90.58% <100%> (ø) ⬆️
#single 42.35% <55.55%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 85.96% <ø> (ø) ⬆️
pandas/io/formats/style.py 96.43% <100%> (ø) ⬆️
pandas/core/indexes/multi.py 95.41% <100%> (ø) ⬆️
pandas/core/common.py 97.39% <100%> (+0.05%) ⬆️
pandas/core/indexes/base.py 96.45% <100%> (ø) ⬆️

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 0976e12...162962e. Read the comment docs.

@@ -1551,6 +1551,10 @@ def __setstate__(self, state):

def __getitem__(self, key):
if is_scalar(key):
if lib.is_float(key) and key == int(key):
# Avoid DeprecationWarning for non-integer number indexer
Copy link
Contributor

Choose a reason for hiding this comment

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

we do this a number of times in the indexing code

i think we have a function

maybe_convert_to_int_indexer iirc

if not can u make one

Copy link
Member Author

Choose a reason for hiding this comment

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

Index._convert_scalar_indexer looks like a candidate; need to check where it is called.

Copy link
Member Author

Choose a reason for hiding this comment

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

I take it back. core.common is right next to is_bool_indexer is the place for this.

@jreback jreback added the Deprecate Functionality to remove in pandas label Sep 9, 2018
@jreback jreback added this to the 0.24.0 milestone Sep 9, 2018
@jreback jreback added the Testing pandas testing functions or related to the test suite label Sep 9, 2018
@jreback jreback merged commit a959ca2 into pandas-dev:master Sep 12, 2018
@jreback
Copy link
Contributor

jreback commented Sep 12, 2018

thanks! some more if you have a chance :>

@jbrockmendel jbrockmendel deleted the ciwarns branch September 12, 2018 13:42
aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas 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