def test_address_field(): # pylint: disable=protected-access field = AddressField() attr = 'test' data = object() # invalid hex data with pytest.raises(Exception): field._deserialize('-', attr, data) # invalid address, too short with pytest.raises(Exception): field._deserialize('1234', attr, data) # missing prefix 0x with pytest.raises(Exception): field._deserialize('414d72a6f6e28f4950117696081450d63d56c354', attr, data) address = b'AMr\xa6\xf6\xe2\x8fIP\x11v\x96\x08\x14P\xd6=V\xc3T' assert field._deserialize('0x414d72a6f6e28f4950117696081450d63d56c354', attr, data) == address
def test_address_field(): # pylint: disable=protected-access field = AddressField() attr = "test" data = object() # invalid hex data with pytest.raises(Exception): field._deserialize("-", attr, data) # invalid address, too short with pytest.raises(Exception): field._deserialize("0x1234", attr, data) # missing prefix 0x with pytest.raises(Exception): field._deserialize("414d72a6f6e28f4950117696081450d63d56c354", attr, data) address = b"AMr\xa6\xf6\xe2\x8fIP\x11v\x96\x08\x14P\xd6=V\xc3T" assert field._deserialize("0x414D72a6f6E28F4950117696081450d63D56C354", attr, data) == address
def test_address_field(): # pylint: disable=protected-access field = AddressField() attr = 'test' data = object() # invalid hex data with pytest.raises(Exception): field._deserialize('-', attr, data) # invalid address, too short with pytest.raises(Exception): field._deserialize('0x1234', attr, data) # missing prefix 0x with pytest.raises(Exception): field._deserialize('414d72a6f6e28f4950117696081450d63d56c354', attr, data) address = b'AMr\xa6\xf6\xe2\x8fIP\x11v\x96\x08\x14P\xd6=V\xc3T' assert field._deserialize('0x414d72a6f6e28f4950117696081450d63d56c354', attr, data) == address