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

Function test_rev_range

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

Source from the content-addressed store, hash-verified

407@pytest.mark.redismod
408@skip_ifmodversion_lt("1.10.0", "timeseries")
409def test_rev_range(client):
410 for i in range(100):
411 client.ts().add(1, i, i % 7)
412 assert 100 == len(client.ts().range(1, 0, 200))
413 for i in range(100):
414 client.ts().add(1, i + 200, i % 7)
415 assert 200 == len(client.ts().range(1, 0, 500))
416 # first sample isn't returned
417 assert 20 == len(
418 client.ts().revrange(1, 0, 500, aggregation_type="avg", bucket_size_msec=10)
419 )
420 assert 10 == len(client.ts().revrange(1, 0, 500, count=10))
421 assert 2 == len(
422 client.ts().revrange(
423 1,
424 0,
425 500,
426 filter_by_ts=[i for i in range(10, 20)],
427 filter_by_min_value=1,
428 filter_by_max_value=2,
429 )
430 )
431 assert_resp_response(
432 client,
433 client.ts().revrange(
434 1, 0, 10, aggregation_type="count", bucket_size_msec=10, align="+"
435 ),
436 [(10, 1.0), (0, 10.0)],
437 [[10, 1.0], [0, 10.0]],
438 )
439 assert_resp_response(
440 client,
441 client.ts().revrange(
442 1, 0, 10, aggregation_type="count", bucket_size_msec=10, align=1
443 ),
444 [(1, 10.0), (0, 1.0)],
445 [[1, 10.0], [0, 1.0]],
446 )
447 assert_resp_response(
448 client,
449 client.ts().revrange(1, 0, 10, aggregation_type="twa", bucket_size_msec=10),
450 [(10, 3.0), (0, 2.55)],
451 [[10, 3.0], [0, 2.55]],
452 )
453
454
455@pytest.mark.onlynoncluster

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected