11import asyncio
22import binascii
33import datetime
4+ import math
45import ssl
56import warnings
67from typing import Any , Awaitable , Callable , Dict , List , Optional , Type , Union
@@ -1556,23 +1557,23 @@ async def test_cluster_bitop_not_empty_string(self, r: ValkeyCluster) -> None:
15561557
15571558 @skip_if_server_version_lt ("2.6.0" )
15581559 async def test_cluster_bitop_not (self , r : ValkeyCluster ) -> None :
1559- test_str = b"\xAA \x00 \xFF \x55 "
1560+ test_str = b"\xaa \x00 \xff \x55 "
15601561 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
15611562 await r .set ("{foo}a" , test_str )
15621563 await r .bitop ("not" , "{foo}r" , "{foo}a" )
15631564 assert int (binascii .hexlify (await r .get ("{foo}r" )), 16 ) == correct
15641565
15651566 @skip_if_server_version_lt ("2.6.0" )
15661567 async def test_cluster_bitop_not_in_place (self , r : ValkeyCluster ) -> None :
1567- test_str = b"\xAA \x00 \xFF \x55 "
1568+ test_str = b"\xaa \x00 \xff \x55 "
15681569 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
15691570 await r .set ("{foo}a" , test_str )
15701571 await r .bitop ("not" , "{foo}a" , "{foo}a" )
15711572 assert int (binascii .hexlify (await r .get ("{foo}a" )), 16 ) == correct
15721573
15731574 @skip_if_server_version_lt ("2.6.0" )
15741575 async def test_cluster_bitop_single_string (self , r : ValkeyCluster ) -> None :
1575- test_str = b"\x01 \x02 \xFF "
1576+ test_str = b"\x01 \x02 \xff "
15761577 await r .set ("{foo}a" , test_str )
15771578 await r .bitop ("and" , "{foo}res1" , "{foo}a" )
15781579 await r .bitop ("or" , "{foo}res2" , "{foo}a" )
@@ -1583,8 +1584,8 @@ async def test_cluster_bitop_single_string(self, r: ValkeyCluster) -> None:
15831584
15841585 @skip_if_server_version_lt ("2.6.0" )
15851586 async def test_cluster_bitop_string_operands (self , r : ValkeyCluster ) -> None :
1586- await r .set ("{foo}a" , b"\x01 \x02 \xFF \xFF " )
1587- await r .set ("{foo}b" , b"\x01 \x02 \xFF " )
1587+ await r .set ("{foo}a" , b"\x01 \x02 \xff \xff " )
1588+ await r .set ("{foo}b" , b"\x01 \x02 \xff " )
15881589 await r .bitop ("and" , "{foo}res1" , "{foo}a" , "{foo}b" )
15891590 await r .bitop ("or" , "{foo}res2" , "{foo}a" , "{foo}b" )
15901591 await r .bitop ("xor" , "{foo}res3" , "{foo}a" , "{foo}b" )
@@ -2158,7 +2159,9 @@ async def test_geosearchstore_dist(self, r: ValkeyCluster) -> None:
21582159 storedist = True ,
21592160 )
21602161 # instead of save the geo score, the distance is saved.
2161- assert await r .zscore ("{foo}places_barcelona" , "place1" ) == 88.05060698409301
2162+ E = 1e-9
2163+ res = await r .zscore ("{foo}places_barcelona" , "place1" )
2164+ assert math .fabs (res - 88.05060698409301 ) < E
21622165
21632166 @skip_if_server_version_lt ("3.2.0" )
21642167 async def test_cluster_georadius_store (self , r : ValkeyCluster ) -> None :
@@ -2188,7 +2191,9 @@ async def test_cluster_georadius_store_dist(self, r: ValkeyCluster) -> None:
21882191 "{foo}barcelona" , 2.191 , 41.433 , 1000 , store_dist = "{foo}places_barcelona"
21892192 )
21902193 # instead of save the geo score, the distance is saved.
2191- assert await r .zscore ("{foo}places_barcelona" , "place1" ) == 88.05060698409301
2194+ E = 1e-9
2195+ res = await r .zscore ("{foo}places_barcelona" , "place1" )
2196+ assert math .fabs (res - 88.05060698409301 ) < E
21922197
21932198 async def test_cluster_dbsize (self , r : ValkeyCluster ) -> None :
21942199 d = {"a" : b"1" , "b" : b"2" , "c" : b"3" , "d" : b"4" }
0 commit comments