Skip to content

TST: simplify how the different code paths for block are tested. #12259

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

hmaarrfk
Copy link
Contributor

dict(block=_block_force_concatenate),
dict(block=_block_force_slicing)]
@pytest.fixture(params=['block', 'force_concatenate', 'force_slicing'])
def block(request): # maybe needs self, not sure
Copy link
Member

Choose a reason for hiding this comment

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

Assuming this works, should strip this comment out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

man, what a mistake!

@hmaarrfk hmaarrfk force-pushed the block_single_concatenate_simplify_test branch 3 times, most recently from 623da56 to 75e0e75 Compare October 31, 2018 15:05
@hmaarrfk hmaarrfk force-pushed the block_single_concatenate_simplify_test branch from 75e0e75 to ce55462 Compare November 5, 2018 04:03
@hmaarrfk
Copy link
Contributor Author

hmaarrfk commented Nov 5, 2018

@eric-wieser I finally got around to fixing this. I'm glad I was explicit about my tests since it was always falling down to the default case. We needed the self parameter to the function

elif request.param == 'force_slicing':
return _block_force_slicing
elif request.param == 'block':
return block
Copy link
Member

Choose a reason for hiding this comment

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

Note you could also achieve this via the ids parameter to fixture:

@pytest.fixture(
    params=[block, _block_force_concatenate, _block_force_slicing],
    ids=['block', 'force_concatenate', 'force_slicing']
)

Which has the benefit of not needing the final else.
Not really a big deal either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that else statement is more a test on the test. It checks that I know how to use request (which I didn't).

@hmaarrfk
Copy link
Contributor Author

hmaarrfk commented Nov 5, 2018

Thanks for the review @eric-wieser

@charris charris merged commit e1a8230 into numpy:master Nov 6, 2018
@charris
Copy link
Member

charris commented Nov 6, 2018

Thanks @hmaarrfk .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants