Skip to content

CLN: inconsistent namespace usage in tests.indexes #38076

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
merged 1 commit into from
Nov 26, 2020

Conversation

jbrockmendel
Copy link
Member

Finding these annoying while doing other work in this directory.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

can u update the precommit rule

@jbrockmendel
Copy link
Member Author

can u update the precommit rule

short answer: not really. this only gets a handful of things in a handful of files.

i pinged @MarcoGorelli on the script; there are things I think it should catch that it isn't. i dont want to tinker with the script until im confident it is working correctly.

@MarcoGorelli
Copy link
Member

The original script only looks for class names - for methods, I think we could change [A-Z] to \w - I can test it out later

i pinged @MarcoGorelli on the script

Where did you ping me? If it was in another issue then I may have missed it, sorry

@jbrockmendel
Copy link
Member Author

Where did you ping me? If it was in another issue then I may have missed it, sorry

Huh I'm not finding it, my bad. I was asking why CLASS_NAMES had been removed, since ive noticed that both MultiIndex and pd.MultiIndex are present in some of the indexes test files.

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Nov 26, 2020

It might be that they appear if they're present with starting brackets, currently we just check for cases of e.g. MultiIndex( and pd.MultiIndex( being in the same file. pandas/tests/indexes/test_common.py contains pd.MultiIndex and MultiIndex, but neither are called, they're just used in isinstance checks.

Maybe it's OK to remove the paren and extend the check beyond classes now

@jbrockmendel
Copy link
Member Author

Makes sense. For now I'll be happy with just fixing the handful in this PR so I don't keep stumbling over them in other branches.

@MarcoGorelli
Copy link
Member

sure - I've opened #38093 as a placeholder

@jreback
Copy link
Contributor

jreback commented Nov 26, 2020

sure - I've opened #38093 as a placeholder

great yeah we ought to become strict on these

@jreback jreback added the Code Style Code style, linting, code_checks label Nov 26, 2020
@jreback jreback added this to the 1.2 milestone Nov 26, 2020
@jreback jreback added Index Related to the Index class or subclasses Testing pandas testing functions or related to the test suite labels Nov 26, 2020
@jreback jreback merged commit 42084f4 into pandas-dev:master Nov 26, 2020
@jbrockmendel jbrockmendel deleted the tst-imports branch November 26, 2020 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Index Related to the Index class or subclasses Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants