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

Function test_mrange_latest

tests/test_timeseries.py:735–763  ·  view source on GitHub ↗
(client: redis.Redis)

Source from the content-addressed store, hash-verified

733@pytest.mark.redismod
734@skip_ifmodversion_lt("1.8.0", "timeseries")
735def test_mrange_latest(client: redis.Redis):
736 timeseries = client.ts()
737 timeseries.create("t1")
738 timeseries.create("t2", labels={"is_compaction": "true"})
739 timeseries.create("t3")
740 timeseries.create("t4", labels={"is_compaction": "true"})
741 timeseries.createrule("t1", "t2", aggregation_type="sum", bucket_size_msec=10)
742 timeseries.createrule("t3", "t4", aggregation_type="sum", bucket_size_msec=10)
743 timeseries.add("t1", 1, 1)
744 timeseries.add("t1", 2, 3)
745 timeseries.add("t1", 11, 7)
746 timeseries.add("t1", 13, 1)
747 timeseries.add("t3", 1, 1)
748 timeseries.add("t3", 2, 3)
749 timeseries.add("t3", 11, 7)
750 timeseries.add("t3", 13, 1)
751 assert_resp_response(
752 client,
753 client.ts().mrange(0, 10, filters=["is_compaction=true"], latest=True),
754 [{"t2": [{}, [(0, 4.0), (10, 8.0)]]}, {"t4": [{}, [(0, 4.0), (10, 8.0)]]}],
755 {
756 "t2": [{}, {"aggregators": []}, [[0, 4.0], [10, 8.0]]],
757 "t4": [{}, {"aggregators": []}, [[0, 4.0], [10, 8.0]]],
758 },
759 {
760 "t2": [{}, {"aggregators": []}, [[0, 4.0], [10, 8.0]]],
761 "t4": [{}, {"aggregators": []}, [[0, 4.0], [10, 8.0]]],
762 },
763 )
764
765
766@pytest.mark.onlynoncluster

Callers

nothing calls this directly

Calls 6

assert_resp_responseFunction · 0.85
createruleMethod · 0.80
mrangeMethod · 0.80
tsMethod · 0.45
createMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected