Skip to content

Docstring of time_delta argument minimum_unit conflicts with implementation #582

Description

@mjpieters

The docstring for time_delta() says this about the minimum_unit argument:

        minimum_unit: The lowest unit that can be used. Options: "years", "months",
            "days", "hours", "minutes", "seconds", "milliseconds" or "microseconds".

but the implementation will raise an exception if you try to use any value larger than "seconds":

    tmp = Unit[minimum_unit.upper()]
    if tmp not in (Unit.SECONDS, Unit.MILLISECONDS, Unit.MICROSECONDS):
        raise ValueError(f"Minimum unit '{minimum_unit}' not supported")

Either update the docstring to only mention the last three options, or update the code to support the other units too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions