Skip to content

BUG: Pass args and kwargs to empty #6953

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

Conversation

TomAugspurger
Copy link
Contributor

Closes #6952

I wasn't sure what the best way to test this was. I went with calling _apply_empty_result directly and checking for a SystemExit to get around the try: except Exception block in _apply_empty_result.

I still don't think I've 100% ensured that _apply_empty_result will always be called with _args and *_kwargs (if there are any), but if they are passed things will be handled correctly.

@TomAugspurger
Copy link
Contributor Author

Hmm py3 failures. I can't do rase arg in py3 even if arg=ValueError. You have to wrap in an Exception(arg), which gets swallowed up by the try: except block that I'm trying to test...

suggestions?

@jreback
Copy link
Contributor

jreback commented Apr 24, 2014

not sure if it really needs a test; if it doesn't break anything else its ok

@jreback jreback added this to the 0.14.0 milestone Apr 24, 2014
@jreback
Copy link
Contributor

jreback commented Apr 24, 2014

do you have an example that failed before? and works now?

e.g. a function on an empty frame, that could be a test

(don't have to test the generic reduction test though)

@TomAugspurger
Copy link
Contributor Author

My tests in #6955 fail without this, so that should be good right?

@TomAugspurger
Copy link
Contributor Author

specifically

        # test degenerate case
        q = DataFrame({'x': [], 'y': []}).quantile(0.1, axis=0)
        assert(np.isnan(q['x']) and np.isnan(q['y']))

in pandas/tests/test_frame:TestDataFrame.test_quantile

@jreback
Copy link
Contributor

jreback commented Apr 24, 2014

oh sorry..didn't see that (that's ok then)

maybe in the other PR reference the PR number just in case

TomAugspurger pushed a commit that referenced this pull request Apr 24, 2014
@TomAugspurger TomAugspurger merged commit 682ac7f into pandas-dev:master Apr 24, 2014
@TomAugspurger TomAugspurger deleted the _apply_empty_result-args branch April 5, 2017 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: _apply_empty_result should take function args
2 participants