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

Empty List of Granularities For Humanize Doesn't Raise Value Error #1015

Closed
anishnya opened this issue Aug 7, 2021 · 1 comment · Fixed by #1016
Closed

Empty List of Granularities For Humanize Doesn't Raise Value Error #1015

anishnya opened this issue Aug 7, 2021 · 1 comment · Fixed by #1016
Labels

Comments

@anishnya
Copy link
Member

anishnya commented Aug 7, 2021

Issue Description

It appears that we don't do any error checking if we pass in an empty list of granularities for humanize.

    import arrow
    arw = arrow.Arrow(2013, 1, 1, 0, 0, 0)
    later = arw.shift(seconds=3600)
    humanize_string = arw.humanize(later, granularity=[],)
    print(humanize_string)
    >>> Traceback (most recent call last):
    >>> File "test.py", line 5, in <module>
    >>>  humanize_string = arw.humanize(later, granularity=[], locale="he")
    >>> File "/Users/anishnya/Desktop/production-arrow/env/lib/python3.8/site-packages/arrow/arrow.py", line 1294, in
    ...

@jadchaar @krisfremen @systemcatch are you able to reproduce this? If it's an error, I'll add a check as a part of #997 or open up a separate PR to fix this.

System Info

  • 🖥 OS name and version:
  • 🐍 Python version:
  • 🏹 Arrow version:
@anishnya anishnya added the bug label Aug 7, 2021
@krisfremen
Copy link
Member

@anishnya yes, I'm able to reproduce. raises IndexError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants