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

Add an "all" granularity to humanize #1018

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

MarkKoz
Copy link

@MarkKoz MarkKoz commented Aug 8, 2021

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master 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

Add an "all" granularity to the humanize function. When specified, it internally sets all possible units for the granularity (years, months, weeks, days, hours, minutes, and seconds). This granularity is mutually exclusive with the other granularities; it's not valid to specify it in a list of granularities.

The motivation is that it's more convenient to specify a single string than a list of 7 strings. It will make more sense to use full precision once #997 is merged. Speaking of which, some newly added tests will have to be fixed once #997 is merged and the describe_multi bug is fixed.

Resolve #1014

It's more convenient to pass a simple short string than to pass a list
of 7 strings.

Resolve arrow-py#1014
@codecov
Copy link

codecov bot commented Aug 8, 2021

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (87a1a77) 100.00% compared to head (5b336f2) 100.00%.

❗ Current head 5b336f2 differs from pull request most recent head 71d5233. Consider uploading reports for the commit 71d5233 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1018   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2326      2239   -87     
  Branches       400       440   +40     
=========================================
- Hits          2326      2239   -87     
Files Coverage Δ
arrow/arrow.py 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tests/test_arrow.py Outdated Show resolved Hide resolved
jadchaar and others added 7 commits October 14, 2021 23:41
The assertions only worked for certain dates and times. For example,
a difference of 2 months could result in "1 month and 29 days" rather
than "2 months" depending on the start time. Since utcnow() was used,
assertions could fail if ran at a later date. Fix this by using a fixed
time for test data rather than utcnow().
Since arrow-py#996 was fixed by arrow-py#1077, the test no longer needs to use the
incorrect data to work around the bug.
@MarkKoz
Copy link
Author

MarkKoz commented Dec 28, 2021

The lint check failure seems to be a problem with CI rather than with my changes.

@systemcatch
Copy link
Collaborator

Hmmm lint passes now, looks like it was some kind of setuptools install error that was causing issues.

@jadchaar
Copy link
Member

Hi @MarkKoz mind resolving the conflicts in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Release 1.2.0
In progress
Development

Successfully merging this pull request may close these issues.

Add an "all" granularity to humanize
4 participants