From 25460da25b44778e3db40849b4e6418200fe1809 Mon Sep 17 00:00:00 2001 From: slush Date: Tue, 3 Sep 2024 14:19:34 -0500 Subject: [PATCH] chore: add functional test for hex concat --- tests/functional/conversion/test_hex.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/functional/conversion/test_hex.py b/tests/functional/conversion/test_hex.py index c464fde189..17c618e68d 100644 --- a/tests/functional/conversion/test_hex.py +++ b/tests/functional/conversion/test_hex.py @@ -1,8 +1,9 @@ import pytest +from eth_pydantic_types import HexBytes from eth_utils import to_hex from ape.exceptions import ConversionError -from ape.managers.converters import HexConverter, HexIntConverter +from ape.managers.converters import HexConverter, HexIntConverter, HexIterableConverter @pytest.mark.parametrize("val", ("0xA100", "0x0A100", "0x00a100")) @@ -23,3 +24,25 @@ def test_missing_prefix(convert): with pytest.raises(ConversionError): convert(hex_value, int) + + +@pytest.mark.parametrize( + "calldata,expected", + ( + ( + ["0x123456", "0xabcd"], + "0x123456abcd", + ), + ( + [HexBytes("0x123456"), "0xabcd"], + "0x123456abcd", + ), + ( + ("0x123456", "0xabcd"), + "0x123456abcd", + ), + ), +) +def test_hex_concat(calldata, expected, convert): + assert HexIterableConverter().is_convertible(calldata) + assert convert(calldata, bytes) == HexBytes(expected)