@@ -1692,23 +1692,23 @@ def test_cluster_bitop_not_empty_string(self, r):
1692
1692
1693
1693
@skip_if_server_version_lt ("2.6.0" )
1694
1694
def test_cluster_bitop_not (self , r ):
1695
- test_str = b"\xAA \x00 \xFF \x55 "
1695
+ test_str = b"\xaa \x00 \xff \x55 "
1696
1696
correct = ~ 0xAA00FF55 & 0xFFFFFFFF
1697
1697
r ["{foo}a" ] = test_str
1698
1698
r .bitop ("not" , "{foo}r" , "{foo}a" )
1699
1699
assert int (binascii .hexlify (r ["{foo}r" ]), 16 ) == correct
1700
1700
1701
1701
@skip_if_server_version_lt ("2.6.0" )
1702
1702
def test_cluster_bitop_not_in_place (self , r ):
1703
- test_str = b"\xAA \x00 \xFF \x55 "
1703
+ test_str = b"\xaa \x00 \xff \x55 "
1704
1704
correct = ~ 0xAA00FF55 & 0xFFFFFFFF
1705
1705
r ["{foo}a" ] = test_str
1706
1706
r .bitop ("not" , "{foo}a" , "{foo}a" )
1707
1707
assert int (binascii .hexlify (r ["{foo}a" ]), 16 ) == correct
1708
1708
1709
1709
@skip_if_server_version_lt ("2.6.0" )
1710
1710
def test_cluster_bitop_single_string (self , r ):
1711
- test_str = b"\x01 \x02 \xFF "
1711
+ test_str = b"\x01 \x02 \xff "
1712
1712
r ["{foo}a" ] = test_str
1713
1713
r .bitop ("and" , "{foo}res1" , "{foo}a" )
1714
1714
r .bitop ("or" , "{foo}res2" , "{foo}a" )
@@ -1719,8 +1719,8 @@ def test_cluster_bitop_single_string(self, r):
1719
1719
1720
1720
@skip_if_server_version_lt ("2.6.0" )
1721
1721
def test_cluster_bitop_string_operands (self , r ):
1722
- r ["{foo}a" ] = b"\x01 \x02 \xFF \xFF "
1723
- r ["{foo}b" ] = b"\x01 \x02 \xFF "
1722
+ r ["{foo}a" ] = b"\x01 \x02 \xff \xff "
1723
+ r ["{foo}b" ] = b"\x01 \x02 \xff "
1724
1724
r .bitop ("and" , "{foo}res1" , "{foo}a" , "{foo}b" )
1725
1725
r .bitop ("or" , "{foo}res2" , "{foo}a" , "{foo}b" )
1726
1726
r .bitop ("xor" , "{foo}res3" , "{foo}a" , "{foo}b" )
@@ -3260,6 +3260,27 @@ def raise_ask_error():
3260
3260
assert ask_node .redis_connection .connection .read_response .called
3261
3261
assert res == ["MOCK_OK" ]
3262
3262
3263
+ def test_error_is_truncated (self , r ):
3264
+ """
3265
+ Test that an error from the pipeline is truncated correctly.
3266
+ """
3267
+ key = "a" * 5000
3268
+
3269
+ pipe = r .pipeline (transaction = False )
3270
+
3271
+ with r .pipeline () as pipe :
3272
+ pipe .set (key , 1 )
3273
+ pipe .llen (key )
3274
+ pipe .expire (key , 100 )
3275
+
3276
+ with pytest .raises (Exception ) as ex :
3277
+ pipe .execute ()
3278
+
3279
+ expected = (
3280
+ "Command # 2 (LLEN " + ("a" * 95 ) + "...) of pipeline caused error: "
3281
+ )
3282
+ assert str (ex .value ).startswith (expected )
3283
+
3263
3284
def test_return_previously_acquired_connections (self , r ):
3264
3285
# in order to ensure that a pipeline will make use of connections
3265
3286
# from different nodes
0 commit comments