From a8a39ace5d9ea645883c487adad843d5c7ba4b60 Mon Sep 17 00:00:00 2001 From: Erik Forsberg Date: Tue, 20 Oct 2020 11:11:11 +0200 Subject: [PATCH] Adds test for #674 that fails only on Cython --- t/unit/windows/test_hopping_window.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/t/unit/windows/test_hopping_window.py b/t/unit/windows/test_hopping_window.py index 48af66582..56280c2de 100644 --- a/t/unit/windows/test_hopping_window.py +++ b/t/unit/windows/test_hopping_window.py @@ -1,3 +1,4 @@ +from pytest import approx from faust.windows import HoppingWindow @@ -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)