Skip to content

Commit 115d911

Browse files
committed
Add ringbuffer tests for indices of datetime and None
1 parent 38c91e5 commit 115d911

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/timeseries/test_ringbuffer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,15 @@ def get_orb(data: FloatArray) -> OrderedRingBuffer[FloatArray]:
522522
def test_window_datetime() -> None:
523523
"""Test the window function with datetime."""
524524
buffer = get_orb(np.array([0, None, 2, 3, 4]))
525+
# Test datetime and Nones
526+
win = buffer.window(None, None)
527+
assert [0, np.nan, 2, 3, 4] == list(win)
528+
with pytest.raises(ValueError):
529+
win = buffer.window(dt(0), None)
530+
#assert [0, np.nan, 2, 3, 4] == list(win) # should not raise
531+
with pytest.raises(ValueError):
532+
win = buffer.window(None, dt(4))
533+
#assert [0, np.nan, 2, 3, 4] == list(win) # should not raise
525534
win = buffer.window(dt(0), dt(3), force_copy=False, fill_value=None)
526535
assert [0, np.nan, 2] == list(win)
527536
buffer._buffer[1] = 1 # pylint: disable=protected-access

0 commit comments

Comments
 (0)