-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Updating generic.py error message #8618
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
return groupby(self, by, axis=axis, level=level, as_index=as_index, | ||
sort=sort, group_keys=group_keys, squeeze=squeeze) | ||
except AttributeError: | ||
raise TypeError('You have to at least specify one of by or level') |
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.
can you quote by
and level
? (so "You ... 'by' or 'level'"
), then it is more clear it are the keywords
Thanks for the PR! Strange, for some reason Travis is not triggered to run the test suite. |
Hi Joris, |
Updated based on your previous comments Joris. Let me know what you think. |
going to need a specific test to validate this new behavior (eg need to hit and validate each of the branches) model after assertRaisesRegex usage |
Any suggestion what I test for - just by each argument? |
someting like (error message should match, this was off the cuff)
so should have 4 tests to cover |
Let me know if this works or not. I had some travis CI problems. Submitting a new build |
The updated code is added included the tests. It passes the Travis CI build |
@@ -1981,6 +1993,32 @@ def test_groupby_level_apply(self): | |||
result = frame['A'].groupby(level=0).count() | |||
self.assertEqual(result.index.name, 'first') | |||
|
|||
def g(): |
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.
just put all of these under one new function (the 4 tests), maybe test_groupby_args
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.
add the issue number as a comment
see git help here:https://github.com/pydata/pandas/wiki/Using-Git just rebase the offending commit away and force push |
any update? |
hmm, it seems you have lost the actual change you made. The tests are there though. |
Sorting it out now :) On Thu, Oct 30, 2014 at 12:17 AM, jreback notifications@github.com wrote:
Peadar Coyle |
frame = self.mframe | ||
def g(): | ||
frame.groupby(level=None).count() | ||
self.assertRaisesRegexp(TypeError, g, "You have to supply one of 'by' or 'level'") |
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.
The assert should not be in the function definition, as in this way it is not called:
def g():
frame.groupby(..)
self.assert ...
@hayd Hey Andy, I was having a look at this - andd got some feedback (bad tests the first time I submitted). I'm trying to figure out a way to test for df.groupby() as we all agree that should return an error. But I keep running into the errors above in my tests. Any suggestions? |
Fix unrecognized 'Z' UTC designator
DOC: Issue #8805
For consistency with [PEP8][1]: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. [1]: https://www.python.org/dev/peps/pep-0008#id17
CLN: move import to top of file
Option context no longer overrides options when used outside a `with` statement. Added test TestConfig.test_option_config_scope Closes #8514
DOC: specify return type in to_datetime
BUG: Option context applies on __enter__
$ nosetests pandas/core/common.py --with-doc -v
BUG: DatetimeIndex with time object as key
BUG: fix doctests in pandas.core.common
Categorical: let unique only return used categories
Sorry @jreback just rebasing and submitting now. |
Still getting some test failures - but none seem related my own code... I'm a bit confused. Does anyone have any advice? |
You have included a lot of other commits, maybe something there is causing the errors. Can you do on your branch:
|
Deleting this branch - starting again - with a new one, this might make it easier. |
This is my first attempt at a PR. I just made a little change to allow an error message. Would appreciate some feedback.
closes #8015