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

Fix tick delta type handling #546

Merged
merged 6 commits into from
May 8, 2024
Merged

Fix tick delta type handling #546

merged 6 commits into from
May 8, 2024

Commits on Apr 25, 2024

  1. Fix tick delta type handling

    ## `FrozenDateTimeFactory.tick`
    The `delta` argument is capable of handling `float`s. In previous versions of
    freezgun, the `.pyi` type annotations were correctly reflecting that. For some
    reason, when moving the type annotations into the `.py` file, this information
    got lost.
    
    Further, checking for `isinstance(delta, numbers.Real)` is probably not what
    was intended as `fraction.Fraction` is a subclass of `Real`, but will cause an
    error when passed into `datetime.timedelta(seconds=delta)`.
    
    ## `StepTickTimeFactory.tick`
    The same issue with the type hint applies here.
    
    Fruther, passing an integer/float `delta` would lead to that number being added
    to the frozen `datetime.datetime`, which is not a valid operation
    (`TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'int'`).
    robsdedude committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    c963608 View commit details
    Browse the repository at this point in the history

Commits on May 6, 2024

  1. Fix instance checks

    robsdedude committed May 6, 2024
    Configuration menu
    Copy the full SHA
    d2872d0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    be779f4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    023c7a3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    aecc78a View commit details
    Browse the repository at this point in the history
  5. Extend type checking

    robsdedude committed May 6, 2024
    Configuration menu
    Copy the full SHA
    df263dc View commit details
    Browse the repository at this point in the history