MCPcopy
hub / github.com/redis/redis-py / test_range_advanced

Function test_range_advanced

tests/test_timeseries.py:275–299  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

273@pytest.mark.redismod
274@skip_ifmodversion_lt("1.10.0", "timeseries")
275def test_range_advanced(client):
276 for i in range(100):
277 client.ts().add(1, i, i % 7)
278 client.ts().add(1, i + 200, i % 7)
279
280 assert 2 == len(
281 client.ts().range(
282 1,
283 0,
284 500,
285 filter_by_ts=[i for i in range(10, 20)],
286 filter_by_min_value=1,
287 filter_by_max_value=2,
288 )
289 )
290 res = client.ts().range(
291 1, 0, 10, aggregation_type="count", bucket_size_msec=10, align="+"
292 )
293 assert_resp_response(client, res, [(0, 10.0), (10, 1.0)], [[0, 10.0], [10, 1.0]])
294 res = client.ts().range(
295 1, 0, 10, aggregation_type="count", bucket_size_msec=10, align=5
296 )
297 assert_resp_response(client, res, [(0, 5.0), (5, 6.0)], [[0, 5.0], [5, 6.0]])
298 res = client.ts().range(1, 0, 10, aggregation_type="twa", bucket_size_msec=10)
299 assert_resp_response(client, res, [(0, 2.55), (10, 3.0)], [[0, 2.55], [10, 3.0]])
300
301
302@pytest.mark.onlynoncluster

Callers

nothing calls this directly

Calls 4

assert_resp_responseFunction · 0.85
rangeMethod · 0.80
addMethod · 0.45
tsMethod · 0.45

Tested by

no test coverage detected