| 189 | |
| 190 | @pytest.mark.redismod |
| 191 | def 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 |