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
Make start of week adjustable when using span #934
Make start of week adjustable when using span #934
Conversation
Hi @ALee008, thanks for the PR. I will try to review this in the next couple of weeks, I am pretty swamped at the moment. Hopefully @krisfremen or @systemcatch could review it in the meantime. |
Also, the tests are currently failing because of an XFailed pytest test case that is decreasing coverage. I will submit a patch to get this resolved. |
Hey @jadchaar , |
Codecov Report
@@ Coverage Diff @@
## master #934 +/- ##
=======================================
Coverage 99.74% 99.74%
=======================================
Files 10 10
Lines 1944 1947 +3
Branches 312 313 +1
=======================================
+ Hits 1939 1942 +3
Misses 4 4
Partials 1 1
Continue to review full report at Codecov.
|
Hey @ALee008 have you installed all the dependencies needed to run the tests? You need to install the following; pip install tox
pip install pre-commit
pip install mypy
pip install -r requirements.txt Also if you have |
Hey @systemcatch , I haven't installed these. Will do and re-test. Thank you. |
Hey @systemcatch , all linting were successful but ´test_shift_kiritimati´ is still failing. How should I proceed now? |
Try pulling the latest code @ALee008, it seems like the CI runs are only failing on linting now: https://github.com/arrow-py/arrow/pull/934/checks |
@ALee008 what is the output of |
My ´pip list´result (running in an virtual env). Package Version alabaster 0.7.12 |
Will do and retry. |
arrow/arrow.py
Outdated
>>> arrow.utcnow().span('week', weekday=6) | ||
(<Arrow [2021-02-20T00:00:00+00:00]>, <Arrow [2021-02-26T23:59:59.999999+00:00]>) |
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.
Maybe compare this with a normal span("week")
to highlight the difference.
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.
Hey,
extended doc string in latest commit.
tests/test_arrow.py
Outdated
@@ -1754,6 +1754,11 @@ def test_span_week(self): | |||
assert floor == datetime(2013, 2, 11, tzinfo=tz.tzutc()) | |||
assert ceil == datetime(2013, 2, 17, 23, 59, 59, 999999, tzinfo=tz.tzutc()) | |||
|
|||
floor, ceil = self.arrow.span("week", weekday=6) |
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.
We should also test what happens if a bad value is provided (i.e. week_start=55
)
Co-authored-by: Chris <30196510+systemcatch@users.noreply.github.com>
arrow/arrow.py
Outdated
>>> arrow.utcnow().span('week', week_start=1) | ||
(<Arrow [2021-02-22T00:00:00+00:00]>, <Arrow [2021-02-28T23:59:59.999999+00:00]>) |
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.
No need for these line as it uses the default value above.
It didn't seem to fix the problem. Any suggestions? |
Weird I don't understand why this is still failing, @jadchaar any ideas? |
Yeah I fixed it--it was a trailing whitespace. |
Will do an push. |
…to BR_choose_weekday_using_span
@jadchaar can you take a look at this again? I'm afk until Saturday night but will try to fix this then otherwise. |
Yup fixed, it was a docs indent issue. |
Hi @ALee008, apologies. I am still trying to understand the logic of finding the delta: |
Hey @jadchaar, so the way I interpret the requirement is as follows: Be case 1: Let's take Chris's example, Because of case 2 the week would be spanned from Thursday 2021-04-01 to Thursday 2021-04-08. Hope this makes my approach clearer. |
Mind adding a few more test cases that cover both the cases you mention @ALee008? Then we can work to finally get this merged :). |
…to BR_choose_weekday_using_span
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 for your perseverance @ALee008, we're good to merge this in now.
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.
LGTM
I also have to thank you. You guys are doing a great job! |
…ng span in combination with frame == "week"
Pull Request Checklist
Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:
tox
ormake test
to find out!). --> see comments belowtox -e lint
ormake lint
to find out!). --> see comment belowmaster
branch.If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!
Description of Changes
Closes: #355
This is my first PR and I choose this issue because it was labeled as 'good first issue'. I added a new parameter
weekday
that can be used in combination withframe == "week"
to choose a start day forarrow.span()
.My tests weren't successful. There was an issue with Python3.6 and an error. I ran the tests again against the master code and encountered the same error, see screenshots:
Master Error:
Master Summary:
These where the only problems I encountered after implementing my changes.
Furthermore I had problems running the linting, I got the following message:
I hope we can resolve these issues. Thank you and kind regards.