@@ -146,7 +146,6 @@ async def get_mocked_redis_client(
146146 with mock .patch .object (ClusterNode , "execute_command" ) as execute_command_mock :
147147
148148 async def execute_command (* _args , ** _kwargs ):
149-
150149 if _args [0 ] == "CLUSTER SLOTS" :
151150 if cluster_slots_raise_error :
152151 raise ResponseError ()
@@ -1577,23 +1576,23 @@ async def test_cluster_bitop_not_empty_string(self, r: RedisCluster) -> None:
15771576
15781577 @skip_if_server_version_lt ("2.6.0" )
15791578 async def test_cluster_bitop_not (self , r : RedisCluster ) -> None :
1580- test_str = b"\xAA \x00 \xFF \x55 "
1579+ test_str = b"\xaa \x00 \xff \x55 "
15811580 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
15821581 await r .set ("{foo}a" , test_str )
15831582 await r .bitop ("not" , "{foo}r" , "{foo}a" )
15841583 assert int (binascii .hexlify (await r .get ("{foo}r" )), 16 ) == correct
15851584
15861585 @skip_if_server_version_lt ("2.6.0" )
15871586 async def test_cluster_bitop_not_in_place (self , r : RedisCluster ) -> None :
1588- test_str = b"\xAA \x00 \xFF \x55 "
1587+ test_str = b"\xaa \x00 \xff \x55 "
15891588 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
15901589 await r .set ("{foo}a" , test_str )
15911590 await r .bitop ("not" , "{foo}a" , "{foo}a" )
15921591 assert int (binascii .hexlify (await r .get ("{foo}a" )), 16 ) == correct
15931592
15941593 @skip_if_server_version_lt ("2.6.0" )
15951594 async def test_cluster_bitop_single_string (self , r : RedisCluster ) -> None :
1596- test_str = b"\x01 \x02 \xFF "
1595+ test_str = b"\x01 \x02 \xff "
15971596 await r .set ("{foo}a" , test_str )
15981597 await r .bitop ("and" , "{foo}res1" , "{foo}a" )
15991598 await r .bitop ("or" , "{foo}res2" , "{foo}a" )
@@ -1604,8 +1603,8 @@ async def test_cluster_bitop_single_string(self, r: RedisCluster) -> None:
16041603
16051604 @skip_if_server_version_lt ("2.6.0" )
16061605 async def test_cluster_bitop_string_operands (self , r : RedisCluster ) -> None :
1607- await r .set ("{foo}a" , b"\x01 \x02 \xFF \xFF " )
1608- await r .set ("{foo}b" , b"\x01 \x02 \xFF " )
1606+ await r .set ("{foo}a" , b"\x01 \x02 \xff \xff " )
1607+ await r .set ("{foo}b" , b"\x01 \x02 \xff " )
16091608 await r .bitop ("and" , "{foo}res1" , "{foo}a" , "{foo}b" )
16101609 await r .bitop ("or" , "{foo}res2" , "{foo}a" , "{foo}b" )
16111610 await r .bitop ("xor" , "{foo}res3" , "{foo}a" , "{foo}b" )
@@ -2803,6 +2802,25 @@ async def test_asking_error(self, r: RedisCluster) -> None:
28032802 assert ask_node ._free .pop ().read_response .await_count
28042803 assert res == ["MOCK_OK" ]
28052804
2805+ async def test_error_is_truncated (self , r ) -> None :
2806+ """
2807+ Test that an error from the pipeline is truncated correctly.
2808+ """
2809+ key = "a" * 5000
2810+
2811+ async with r .pipeline () as pipe :
2812+ pipe .set (key , 1 )
2813+ pipe .llen (key )
2814+ pipe .expire (key , 100 )
2815+
2816+ with pytest .raises (Exception ) as ex :
2817+ await pipe .execute ()
2818+
2819+ expected = (
2820+ "Command # 2 (LLEN " + ("a" * 92 ) + "...) of pipeline caused error: "
2821+ )
2822+ assert str (ex .value ).startswith (expected )
2823+
28062824 async def test_moved_redirection_on_slave_with_default (
28072825 self , r : RedisCluster
28082826 ) -> None :
0 commit comments