diff --git a/eth_abi/codec.py b/eth_abi/codec.py index de04c0d5..2903f9ff 100644 --- a/eth_abi/codec.py +++ b/eth_abi/codec.py @@ -32,7 +32,7 @@ class BaseABICodecEncoder(): def __init__(self, registry): if registry is None: raise ValueError("`registry` may not be None") - + self._registry = registry def encode_single(self, typ: TypeStr, arg: Any) -> bytes: diff --git a/tests/test_codec/test_base_abi_codec_encoder.py b/tests/test_codec/test_base_abi_codec_encoder.py index 98aaf9d0..ef0329b2 100644 --- a/tests/test_codec/test_base_abi_codec_encoder.py +++ b/tests/test_codec/test_base_abi_codec_encoder.py @@ -1,4 +1,10 @@ +import pytest + from eth_abi.codec import ( BaseABICodecEncoder, ) + +def test_init_raises_error_for_null_registry(): + with pytest.raises(ValueError): + BaseABICodecEncoder(None)