Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
COMPAT: Fix indent level bug preventing wrapper function rename #14620
Conversation
|
can u add some tests for this (and validate all functions names in the whitelist would be great) |
matthagy
commented
Nov 9, 2016
|
@jreback, tried adding a test for all whitelist function names and discovered there are additional places where attribute and method names are inconsistent. Replaced that with a test that only covers the names corresponding to this current bug fix. If you think it makes sense to hold off until all whitelist function names are properly handled then I can close this PR for now and open an issue. |
|
just make it 2. tests |
matthagy
commented
Nov 9, 2016
|
@jreback, added back failing test, commented out, and marked w/ TODO. Does reuse a an existing test to prevent duplicating whitelists or refactoring them to be class members. Let me know if you had something else in mind. |
| - getattr(type(gb), m) | ||
| + f = getattr(type(gb), m) | ||
| + # TODO: Fix inconsistencies between attribute and method names | ||
| + # self.assertEqual(f.__name__, m) |
matthagy
commented
Nov 9, 2016
|
@jreback, revised test to show things in whitelist that currently fail. Test now also handles all of the other whitelist cases that aren't known issues. |
jreback
added API Design Bug Groupby
labels
Nov 11, 2016
| @@ -5986,11 +5986,44 @@ def test_groupby_whitelist(self): | ||
| # 'nlargest', 'nsmallest', | ||
| ]) | ||
| + # TODO: Fix these inconsistencies between attribute and method names |
| + 'dtype', | ||
| + 'unique' | ||
| + ]) | ||
| + | ||
| for obj, whitelist in zip((df, s), (df_whitelist, s_whitelist)): |
jreback
Nov 11, 2016
Contributor
what I mean is create another function where you assert that these are NOT equal (with the sub-list of those that are broken), so that when they are fixed this tests will break (and the list will need to be updated). IOW, create a list like the white-list of the broken ones, have the existing test just skip on them (as you do below), but then create another function that asserts that the broken ones are not equal.
matthagy
commented
Nov 15, 2016
|
@jreback, created the additional test to assert that method |
|
@matthagy can you rebase / update. sorry got a bit lost in the shuffle. |
codecov-io
commented
Dec 22, 2016
•
Codecov Report
@@ Coverage Diff @@
## master #14620 +/- ##
==========================================
- Coverage 90.99% 90.98% -0.02%
==========================================
Files 143 143
Lines 49420 49403 -17
==========================================
- Hits 44972 44949 -23
- Misses 4448 4454 +6
Continue to review full report at Codecov.
|
matthagy
commented
Dec 22, 2016
|
@jreback, rebased. |
|
can you rebase? |
matthagy
commented
Feb 1, 2017
|
@jreback, rebased. |
|
thanks @matthagy |
jreback
added this to the
0.20.0
milestone
Feb 1, 2017
|
can you rebase / update |
|
@matthagy can you rebase / ping on green. |
|
@matthagy I pushed a change here to make this also set Can you push a whatsnew note, otherwise this lgtm. I think you had several TODO's in the tests for functions which don't set things properly, can you have a look at those? |
| @@ -3753,6 +3753,19 @@ def test_groupby_selection_with_methods(self): | ||
| assert_frame_equal(g.filter(lambda x: len(x) == 3), | ||
| g_exp.filter(lambda x: len(x) == 3)) | ||
| + # The methods returned by these attributes don't have a __name__ attribute | ||
| + # that matches that attribute. |
| @@ -3929,6 +3986,12 @@ def test_tab_completion(self): | ||
| 'ffill', 'bfill', 'pad', 'backfill', 'rolling', 'expanding']) | ||
| self.assertEqual(results, expected) | ||
| + def test_groupby_function_rename(self): |
jreback
changed the title from
Fix indent level bug preventing wrapper function rename to COMPAT: Fix indent level bug preventing wrapper function rename
Mar 27, 2017
|
cc @mrocklin |
matthagy
and others
added some commits
Nov 9, 2016
jreback
closed this
in 2e64614
Mar 28, 2017
mattip
added a commit
to mattip/pandas
that referenced
this pull request
Apr 3, 2017
|
|
jreback + mattip |
532f8d4
|
linebp
added a commit
to linebp/pandas
that referenced
this pull request
Apr 17, 2017
|
|
jreback + linebp |
1b97529
|
matthagy commentedNov 9, 2016
Original code intends to rename the wrapper function f using the provided name, but this isn't happening because code is incorrectly indented an extra level.
Should be 'sum'.