Skip to content

Commit

Permalink
Adds test for robinhood#674 that fails only on Cython
Browse files Browse the repository at this point in the history
  • Loading branch information
forsberg committed Oct 20, 2020
1 parent e2f14ea commit a8a39ac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions t/unit/windows/test_hopping_window.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pytest import approx
from faust.windows import HoppingWindow


Expand Down Expand Up @@ -59,3 +60,18 @@ def test_stale_timestamp(self):
for time in range(0, now_timestamp - expires):
print(f'TIME: {time} NOW TIMESTAMP: {now_timestamp}')
assert window.stale(time, now_timestamp) is True

def test_ranges_types(self):
size = 60
step = 60
window = HoppingWindow(size, step)

# There's nothing special about this timestamp, it was simply when the test was created
timestamp = 1603122451.544989
window_ranges = window.ranges(timestamp)

assert len(window_ranges) == 1
assert type(window_ranges[0][0]) == float
assert type(window_ranges[0][1]) == float
assert window_ranges[0][0] == approx(1603122420.0)
assert window_ranges[0][1] == approx(1603122479.9)

0 comments on commit a8a39ac

Please sign in to comment.