-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: Remove unnecessary uses of pd. in tests #18277
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
Codecov Report
@@ Coverage Diff @@
## master #18277 +/- ##
==========================================
- Coverage 91.4% 91.38% -0.02%
==========================================
Files 164 164
Lines 49878 49878
==========================================
- Hits 45590 45581 -9
- Misses 4288 4297 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #18277 +/- ##
==========================================
- Coverage 91.4% 91.38% -0.02%
==========================================
Files 164 164
Lines 49880 49880
==========================================
- Hits 45591 45583 -8
- Misses 4289 4297 +8
Continue to review full report at Codecov.
|
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.
happy to take this (one small comment). Ideally we could add a linting test for these, something along the lines of (of course have to augment with things we check for, which would things like DataFrame, Index, etc.).
you could start off but explicity using just certain files / dirs for now (IOW as you do them).
you can put this after the np.testing
checks
grep -r -E --include '*.py' 'pd\.Series' pandas/tests/
pandas/tests/test_sorting.py
Outdated
@@ -418,7 +415,7 @@ def test_mixed_integer_from_list(self): | |||
def test_unsortable(self): | |||
# GH 13714 | |||
arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object) | |||
if compat.PY2 and not pd._np_version_under1p10: | |||
if compat.PY2 and not compat.numpy._np_version_under1p10: |
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 import _np_version.... directly up top
@jschendel just that one change is fine for now. the lint checks can be in a followup (or here if you can/want). |
440e6ab
to
92ddd5e
Compare
@jreback : made the one change. not familiar with the lint checks, so I'll hold off until a followup. |
thanks @jschendel would love to come back with something that we can add to |
@@ -1013,7 +1009,7 @@ def test_tab_complete_warning(self, ip): | |||
pytest.importorskip('IPython', minversion="6.0.0") | |||
from IPython.core.completer import provisionalcompleter | |||
|
|||
code = "import pandas as pd; c = pd.Categorical([])" | |||
code = "import pandas as pd; c = Categorical([])" |
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.
@jschendel @jreback why is removing pd OK here? We have a couple tests with this pattern that look fishy to me, but they are passing on master so im confused
passes
git diff upstream/master -u -- "*.py" | flake8 --diff
Mostly edits along the lines of
pd.Series
->Series
for things that were already imported and had redundant uses ofpd
.I cleaned some of the
import
statements, but I didn't import anything new, though that could be done in the future for further cleaning.Was able to shorten some multi-line statements for a net deletion of ~100 lines without changing the content of any tests.
Only did the base level
tests
andtests/indexing
so far.