@@ -210,6 +210,14 @@ def test_range(client):
210
210
assert 10 == len (client .ts ().range (1 , 0 , 500 , count = 10 ))
211
211
212
212
213
+ def round_reply (tuples , digits = 3 ):
214
+ """
215
+ Round the timeseries reply since we are not testing for minute differences
216
+ in server implementation precision
217
+ """
218
+ return [(a , round (b , digits )) for (a , b ) in tuples ]
219
+
220
+
213
221
@pytest .mark .redismod
214
222
@skip_ifmodversion_lt ("99.99.99" , "timeseries" )
215
223
def test_range_advanced (client ):
@@ -233,8 +241,8 @@ def test_range_advanced(client):
233
241
assert [(0 , 5.0 ), (5 , 6.0 )] == client .ts ().range (
234
242
1 , 0 , 10 , aggregation_type = "count" , bucket_size_msec = 10 , align = 5
235
243
)
236
- assert [(0 , 2.5500000000000003 ), (10 , 3.0 )] == client . ts (). range (
237
- 1 , 0 , 10 , aggregation_type = "twa" , bucket_size_msec = 10
244
+ assert [(0 , 2.55 ), (10 , 3.0 )] == round_reply (
245
+ client . ts (). range ( 1 , 0 , 10 , aggregation_type = "twa" , bucket_size_msec = 10 )
238
246
)
239
247
240
248
@@ -343,8 +351,8 @@ def test_rev_range(client):
343
351
assert [(1 , 10.0 ), (0 , 1.0 )] == client .ts ().revrange (
344
352
1 , 0 , 10 , aggregation_type = "count" , bucket_size_msec = 10 , align = 1
345
353
)
346
- assert [(10 , 3.0 ), (0 , 2.5500000000000003 )] == client . ts (). revrange (
347
- 1 , 0 , 10 , aggregation_type = "twa" , bucket_size_msec = 10
354
+ assert [(10 , 3.0 ), (0 , 2.55 )] == round_reply (
355
+ client . ts (). revrange ( 1 , 0 , 10 , aggregation_type = "twa" , bucket_size_msec = 10 )
348
356
)
349
357
350
358
0 commit comments