@@ -1692,23 +1692,23 @@ def test_cluster_bitop_not_empty_string(self, r):
16921692
16931693 @skip_if_server_version_lt ("2.6.0" )
16941694 def test_cluster_bitop_not (self , r ):
1695- test_str = b"\xAA \x00 \xFF \x55 "
1695+ test_str = b"\xaa \x00 \xff \x55 "
16961696 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
16971697 r ["{foo}a" ] = test_str
16981698 r .bitop ("not" , "{foo}r" , "{foo}a" )
16991699 assert int (binascii .hexlify (r ["{foo}r" ]), 16 ) == correct
17001700
17011701 @skip_if_server_version_lt ("2.6.0" )
17021702 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 "
17041704 correct = ~ 0xAA00FF55 & 0xFFFFFFFF
17051705 r ["{foo}a" ] = test_str
17061706 r .bitop ("not" , "{foo}a" , "{foo}a" )
17071707 assert int (binascii .hexlify (r ["{foo}a" ]), 16 ) == correct
17081708
17091709 @skip_if_server_version_lt ("2.6.0" )
17101710 def test_cluster_bitop_single_string (self , r ):
1711- test_str = b"\x01 \x02 \xFF "
1711+ test_str = b"\x01 \x02 \xff "
17121712 r ["{foo}a" ] = test_str
17131713 r .bitop ("and" , "{foo}res1" , "{foo}a" )
17141714 r .bitop ("or" , "{foo}res2" , "{foo}a" )
@@ -1719,8 +1719,8 @@ def test_cluster_bitop_single_string(self, r):
17191719
17201720 @skip_if_server_version_lt ("2.6.0" )
17211721 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 "
17241724 r .bitop ("and" , "{foo}res1" , "{foo}a" , "{foo}b" )
17251725 r .bitop ("or" , "{foo}res2" , "{foo}a" , "{foo}b" )
17261726 r .bitop ("xor" , "{foo}res3" , "{foo}a" , "{foo}b" )
@@ -3260,6 +3260,27 @@ def raise_ask_error():
32603260 assert ask_node .redis_connection .connection .read_response .called
32613261 assert res == ["MOCK_OK" ]
32623262
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+
32633284 def test_return_previously_acquired_connections (self , r ):
32643285 # in order to ensure that a pipeline will make use of connections
32653286 # from different nodes
0 commit comments