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

Function test_add

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

Source from the content-addressed store, hash-verified

120
121@pytest.mark.redismod
122def test_add(client):
123 assert 1 == client.ts().add(1, 1, 1)
124 assert 2 == client.ts().add(2, 2, 3, retention_msecs=10)
125 assert 3 == client.ts().add(3, 3, 2, labels={"Redis": "Labs"})
126 assert 4 == client.ts().add(
127 4, 4, 2, retention_msecs=10, labels={"Redis": "Labs", "Time": "Series"}
128 )
129
130 assert abs(time.time() - float(client.ts().add(5, "*", 1)) / 1000) < 1.0
131
132 info = client.ts().info(4)
133 assert_resp_response(
134 client, 10, info.get("retention_msecs"), info.get("retentionTime")
135 )
136 assert "Labs" == info["labels"]["Redis"]
137
138 # Test for a chunk size of 128 Bytes on TS.ADD
139 assert client.ts().add("time-serie-1", 1, 10.0, chunk_size=128)
140 info = client.ts().info("time-serie-1")
141 assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize"))
142
143
144@pytest.mark.redismod

Callers

nothing calls this directly

Calls 6

assert_resp_responseFunction · 0.85
addMethod · 0.45
tsMethod · 0.45
timeMethod · 0.45
infoMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected