Skip to content

TST: use fixtures in Index common tests #16835

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

Closed
jreback opened this issue Jul 6, 2017 · 0 comments · Fixed by #17622
Closed

TST: use fixtures in Index common tests #16835

jreback opened this issue Jul 6, 2017 · 0 comments · Fixed by #17622
Labels
Testing pandas testing functions or related to the test suite

Comments

@jreback
Copy link
Contributor

jreback commented Jul 6, 2017

https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexes/test_base.py#L36 we define a lot of self.indices that are used in testing (mostly in .common.py), where we iteratore over .indices.values()

if this were made into a parameterize fixture, then the tests can be changed to be a lot simpler. something like.

@pytest.fixture(params=[tm.makeUnicodeIndex(...), tm.make......])
def index(request):
    return request.param

# in common.py
def test_wrong_number_names(self, index):
    def testit(ind):
        ind.names = ["apple", "banana", "carrot"]
    tm.assert_raises_regex(ValueError, "^Length", testit, index)
@jreback jreback added Difficulty Intermediate Testing pandas testing functions or related to the test suite labels Jul 6, 2017
@jreback jreback added this to the Next Major Release milestone Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant