Skip to content

Commit

Permalink
Fix floating-point inaccuracy (#8736)
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmakait authored Jun 28, 2024
1 parent 920bd46 commit a336586
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions distributed/tests/test_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import asyncio
from time import sleep

import pytest

from distributed.metrics import monotonic
from distributed.utils import Deadline
from distributed.utils_test import gen_test
Expand All @@ -11,10 +13,10 @@
def test_deadline():
deadline = Deadline.after(5)

assert deadline.duration == 5
assert deadline.duration == pytest.approx(5)
assert deadline.expired is False
assert deadline.expires is True
assert deadline.expires_at_mono - deadline.started_at_mono == 5
assert deadline.expires_at_mono - deadline.started_at_mono == pytest.approx(5)
assert 4 < deadline.expires_at - deadline.started_at < 6
assert 0 <= deadline.elapsed <= 1
assert 4 <= deadline.remaining <= 5
Expand Down

0 comments on commit a336586

Please sign in to comment.