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

Function test_incrby_decrby

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

Source from the content-addressed store, hash-verified

189
190@pytest.mark.redismod
191def test_incrby_decrby(client):
192 for _ in range(100):
193 assert client.ts().incrby(1, 1)
194 sleep(0.001)
195 assert 100 == client.ts().get(1)[1]
196 for _ in range(100):
197 assert client.ts().decrby(1, 1)
198 sleep(0.001)
199 assert 0 == client.ts().get(1)[1]
200
201 assert client.ts().incrby(2, 1.5, timestamp=5)
202 assert_resp_response(client, client.ts().get(2), (5, 1.5), [5, 1.5])
203 assert client.ts().incrby(2, 2.25, timestamp=7)
204 assert_resp_response(client, client.ts().get(2), (7, 3.75), [7, 3.75])
205 assert client.ts().decrby(2, 1.5, timestamp=15)
206 assert_resp_response(client, client.ts().get(2), (15, 2.25), [15, 2.25])
207
208 # Test for a chunk size of 128 Bytes on TS.INCRBY
209 assert client.ts().incrby("time-serie-1", 10, chunk_size=128)
210 info = client.ts().info("time-serie-1")
211 assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize"))
212
213 # Test for a chunk size of 128 Bytes on TS.DECRBY
214 assert client.ts().decrby("time-serie-2", 10, chunk_size=128)
215 info = client.ts().info("time-serie-2")
216 assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize"))
217
218
219@pytest.mark.redismod

Callers

nothing calls this directly

Calls 6

assert_resp_responseFunction · 0.85
incrbyMethod · 0.45
tsMethod · 0.45
getMethod · 0.45
decrbyMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected