Skip to content
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

Merged
merged 8 commits into from
Jan 23, 2016
Merged

Implement date interval formatting #316

merged 8 commits into from
Jan 23, 2016

Conversation

akx
Copy link
Member

@akx akx commented Jan 4, 2016

Nb: There are some plumbing commits at the top -- the changes there are required by the actual interval code.

Fixes #276

@codecov-io
Copy link

Current coverage is 89.40%

Merging #316 into master will increase coverage by +1.02% as of afd09f0

@@            master   #316   diff @@
=====================================
  Files           23     23       
  Stmts         3626   3736   +110
  Branches         0      0       
  Methods          0      0       
=====================================
+ Hit           3205   3340   +135
  Partial          0      0       
+ Missed         421    396    -25

Review entire Coverage Diff as of afd09f0

Powered by Codecov. Updated on successful CI builds.

@@ -16,6 +16,9 @@
import os
import re
import sys

from babel.dates import split_interval_pattern
Copy link
Contributor

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.

Copy link
Member Author

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...

@etanol
Copy link
Contributor

etanol commented Jan 7, 2016

Looks good. However, for the amount of newly added code, I see few test cases.

@akx
Copy link
Member Author

akx commented Jan 8, 2016

Thanks for prodding me to add more tests, @etanol. Found a few corner-case bugs too, which are now fixed.

@akx akx force-pushed the ivals branch 2 times, most recently from 8bdb885 to 26c13df Compare January 8, 2016 13:08
'jyMMd'

>>> bool(match_skeleton('yMMd', ('qyMMd',), allow_different_fields=False))
False
Copy link
Contributor

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.

Copy link
Member Author

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.

@akx akx force-pushed the ivals branch 4 times, most recently from ea7a817 to c1ec13f Compare January 12, 2016 16:31
@akx
Copy link
Member Author

akx commented Jan 12, 2016

Comments heeded, fixes folded in and branch rebased.

Since Github predictably threw away the commit-related comments, here:

image

@akx
Copy link
Member Author

akx commented Jan 12, 2016

@sils1297, @etanol: This is ready for review again.

dt = datetime.utcnow()
else:
dt = dt.replace(tzinfo=None)
dt = _get_datetime(dt).replace(tzinfo=None)
Copy link
Contributor

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

@akx
Copy link
Member Author

akx commented Jan 13, 2016

Coverage added. :)

@@ -38,6 +38,106 @@
time_ = time


def _get_dt_and_tzinfo(dt_or_tzinfo):
Copy link
Contributor

Choose a reason for hiding this comment

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

This refactor is great!

akx added a commit that referenced this pull request Jan 23, 2016
Implement date interval formatting
@akx akx merged commit 0d78912 into python-babel:master Jan 23, 2016
@akx akx deleted the ivals branch January 23, 2016 19:49
@pyup-bot pyup-bot mentioned this pull request Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants