diff --git a/t/cython/test_cython.py b/t/cython/test_cython.py index 887904c34..8e25945fc 100644 --- a/t/cython/test_cython.py +++ b/t/cython/test_cython.py @@ -7,8 +7,10 @@ class test_Cython: This test is here to ensure we get a clear indication if e.g. Travis fails to correctly install Cython and build our modules """ - @pytest.mark.skipif(not bool(os.environ.get("USE_CYTHON")), reason="Cython not enabled") - @pytest.mark.skipif(bool(os.environ.get('NO_CYTHON', False)), reason="Cython disabled") + @pytest.mark.skipif(not bool(os.environ.get('USE_CYTHON')), + reason='Cython not enabled') + @pytest.mark.skipif(bool(os.environ.get('NO_CYTHON', False)), + reason='Cython disabled') def test_import(self): from faust._cython.windows import HoppingWindow HoppingWindow(60, 60) diff --git a/t/unit/windows/test_hopping_window.py b/t/unit/windows/test_hopping_window.py index 48af66582..95a6c3c41 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,19 @@ 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)