Skip to content

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

Closed
@anishnya

Description

@anishnya

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions