arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Adding brief parameter to humanize

Open akotha7 opened this issue 4 years ago • 3 comments

Pull Request Checklist

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

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

  • Added brief optional parameter to humanize function, based off #1001
  • Added associated tests inside test_arrow.py
  • Updated documentation to reflect new feature

Questions

Current implementation shortens into only_distance and then each term. One edge case that occurs for example is "an hour and 6 minutes" should that become "h 6m" or "1h 6m"

Closes #1001

akotha7 avatar Dec 15 '21 17:12 akotha7

Codecov Report

Merging #1075 (d70fc86) into master (be57df5) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1075   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2232      2243   +11     
  Branches       437       441    +4     
=========================================
+ Hits          2232      2243   +11     
Impacted Files Coverage Δ
arrow/arrow.py 100.00% <100.00%> (ø)
arrow/locales.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update be57df5...d70fc86. Read the comment docs.

codecov[bot] avatar Dec 15 '21 17:12 codecov[bot]

@jadchaar @krisfremen @systemcatch, what are your thoughts here?

anishnya avatar Dec 18 '21 19:12 anishnya

@akotha7 I tend to think we should use the 1h 6m as this seems more consistent to me.

I will try to look this over properly in the next few days.

systemcatch avatar Dec 19 '21 19:12 systemcatch