-
Notifications
You must be signed in to change notification settings - Fork 451
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
Implement date interval formatting #316
Conversation
Current coverage is
|
@@ -16,6 +16,9 @@ | |||
import os | |||
import re | |||
import sys | |||
|
|||
from babel.dates import split_interval_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.
This must go below the sys.path
manipulation, i.e., together with the other babel
imputs. Otherwise, you may import a different Babel version.
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.
Oop, good catch. I just used PyCharm's automatic import generation, so I didn't even notice...
Looks good. However, for the amount of newly added code, I see few test cases. |
Thanks for prodding me to add more tests, @etanol. Found a few corner-case bugs too, which are now fixed. |
8bdb885
to
26c13df
Compare
'jyMMd' | ||
|
||
>>> bool(match_skeleton('yMMd', ('qyMMd',), allow_different_fields=False)) | ||
False |
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 this returns None
just change False
to None
in the docstring. The bool()
wrapping doesn't add any real value here.
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.
An explicit None
there won't work:
>>> match_skeleton('yMMd', ('qyMMd',), allow_different_fields=False)
Expected: None
Got nothing
but leaving the retval out entirely works, so I've done that in a forthcoming revision of the PR.
ea7a817
to
c1ec13f
Compare
dt = datetime.utcnow() | ||
else: | ||
dt = dt.replace(tzinfo=None) | ||
dt = _get_datetime(dt).replace(tzinfo=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.
Why does Codecov show this line as not covered? It should be
Coverage added. :) |
@@ -38,6 +38,106 @@ | |||
time_ = time | |||
|
|||
|
|||
def _get_dt_and_tzinfo(dt_or_tzinfo): |
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.
This refactor is great!
Implement date interval formatting
Nb: There are some plumbing commits at the top -- the changes there are required by the actual interval code.
Fixes #276