-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
TST: strict xfail #38960
TST: strict xfail #38960
Conversation
@@ -466,8 +466,6 @@ def test_insert_index_datetimes(self, fill_val, exp_dtype): | |||
with pytest.raises(TypeError, match=msg): | |||
obj.insert(1, 1) | |||
|
|||
pytest.xfail("ToDo: must coerce to object") |
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.
i think this indicates something that we need to fix. maybe should write out the assertion so that the xfail is meaningful
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.
Thanks @jbrockmendel, I was planning on pinging you and @WillAyd after a bit more digging into this, but you beat me to it :). This was originally changed in #18721 from a comment to the xfail that exists now. The comments were originally added
in 7c0b742. I'm not sure what should be asserted here; from the history it seems like it refers to the tests above.
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.
Also note those comments still exist in the test immediately below.
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.
if we want to coerce to object (and i think we do), then for starters the insert on L467 shouldn't raise but should instead be equivalent to obj.astype(object).insert(1, 1)
. so i think can just change that and then xfail it?
the harder question is what we do in the two cases above that with mismatched tz or mismatched tzawareness. with mismatched tz could just cast (#37605), with mismatched tzawareness could also cast to object.
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.
if you can create an issue for this in followup (and PR if you can!)
@jbrockmendel I adjusted the coercion test, let me know what you think. For the offset test, the value 1000 causes the OutOfBounds exception for Week, Month, etc but not Day. Since the exception is caught, this makes the Day test pass even on 32-bit. One possible resolution is to move the xfail test down (current state of this PR), but I think better would be to find appropriate numbers for the different classes so that we can remove the |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
lgtm. cc @jbrockmendel |
I've looked into implementing my suggested approach in #38960 (comment) but don't see any way of deducing a good value except hard coding on a case-by-case basis. I'll do so if that's desired, but it doesn't seem like a good change to me. |
is that what you're looking for? |
@@ -466,8 +466,6 @@ def test_insert_index_datetimes(self, fill_val, exp_dtype): | |||
with pytest.raises(TypeError, match=msg): | |||
obj.insert(1, 1) | |||
|
|||
pytest.xfail("ToDo: must coerce to object") |
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.
if you can create an issue for this in followup (and PR if you can!)
Thanks @jbrockmendel, that is indeed what I was going for. However reviewing the test again, I think I'm confused on what this test is trying to do. From the comment:
I was under the impression that the test would create an offset large enough so that when it was added to the TimeStamp it would raise an OutOfBoundsDatetime. If this was the case, then one would be expecting the line
to raise. But there are several lines of testing after this, which is why I'm pretty sure I'm missing the point of this test. |
I was thinking the test could be written something like this:
|
@rhshadrach sorry this fell through the cracks of my inbox. is the _get_offset thing still an issue? |
@jbrockmendel - Not a problem, thanks for getting back. I'm really not sure - if my understanding of the test is correct, I think it could be streamlined a bit (and I'd be happy to do), but I have strong suspicions I don't really understand what the test is testing. I tried to explain this in #38960 (comment). If that comment isn't clear, let me know and I can try again. |
Best guess, IIRC there was at one point (maybe still is) some part of the offsets code that would work with pydatetimes instead of Timestamps. Could be that part of the test was intended for those? |
Thanks @jbrockmendel - I finally was able to track down the original implementation of this test in #5327:
Notice here we raise on OutOfBoundsDatetime. The release note from that PR was:
The test I proposed above passes all checks (namely, can always construct an offset that when added to a Timestamp will raise an OutOfBoundsDatetime). I'm thinking that the behavior of returning a datetime is no longer the case and wondering if the test above should be used instead. |
there may be some legacy compat code in there, but i don't think we support pydatetime in any kind of consistent way at this point |
Part of #38902.