-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix makeIntIndex, benchmark get loc #19483
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1560,11 +1560,11 @@ def makeBoolIndex(k=10, name=None): | |
|
||
|
||
def makeIntIndex(k=10, name=None): | ||
return Index(lrange(k), name=name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are you changing this? sure this is an int index, but the ordering is not expected. Revert this, and if you really need it then make a fixture in the appropriate places There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why do you expect an index of int (and not of float, str) to be sorted? What don't you understand in the description of this PR? Sure, I can write all the fixtures you like. It just doesn't make any sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because for testing using something like arange is the expected input. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has nothing to do with the description. you are free to use sorted, unique, not-sorted whatever in a test, but that should be explicit. you are changing a global default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If you expect that, fine to me: shall I then change Currently not only it's not "explicit" if tests run on sorted indexes or not - it actually depends on the type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general when you run a test on different types you want to change only the type. Not other characteristics of the index. Then sure, there are some unavoidable differences (e.g. a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually, the concept itself of "expected input" (referring to content) is completely wrong in a test suite. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls do it my way. you are changing a function that is public facing for no real reason. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oh come on Jeff, the function is clearly not part of the API. I gave "real reasons", you didn't. I even proposed an alternative, which you didn't even comment... you're certainly not going to convince me by asking "pls do it my way". By the way, you are a core dev, you can always merge and then change (e.g. the new asv tests), so if you don't like my PR and don't like to discuss... you don't actually need to waste your time here, just merge and fix to your liking. |
||
return Index(lrange(1, k) + [0], name=name)[:k] | ||
|
||
|
||
def makeUIntIndex(k=10, name=None): | ||
return Index([2**63 + i for i in lrange(k)], name=name) | ||
return Index([2**63 + i for i in (lrange(1, k) + [0])], name=name)[:k] | ||
|
||
|
||
def makeRangeIndex(k=10, name=None): | ||
|
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.
rather than change this, wouldn't it be better to simply fix the
make*
ones? this is pretty much an anti-patter and the reason we have the helpers.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 only way to "fix"
makeIntIndex
for this test to work is to leave it as it is, but as I stated, it limits comparability across index types, since others return unsorted stuff.This test does something different than using the
makeIntIndex
to get "some index filled with integers": it assumes that the result has a specific content. I see this as an anti-pattern.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.
why are you removing testing of RangeIndex? (yes you convert to it, but its not very explicit)
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.
It's just simpler, but OK, I can make it explicit
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.
(done), ping