def block_values_to_hex(block: AttributeDict) -> AttributeDict: formatted_block: Dict = {} for key in block.keys(): value = block[key] try: formatted_block[key] = HexBytes(value) except binascii.Error: formatted_block[key] = value return AttributeDict(formatted_block)
def test_admin_node_info(self, w3: "Web3") -> None: result = w3.geth.admin.node_info() expected = AttributeDict({ 'id': '', 'name': '', 'enode': '', 'ip': '', 'ports': AttributeDict({}), 'listenAddr': '', 'protocols': AttributeDict({}) }) # Test that result gives at least the keys that are listed in `expected` assert not set(expected.keys()).difference(result.keys())
def test_admin_nodeInfo(self, web3): with pytest.warns(DeprecationWarning): result = web3.geth.admin.nodeInfo() expected = AttributeDict({ 'id': '', 'name': '', 'enode': '', 'ip': '', 'ports': AttributeDict({}), 'listenAddr': '', 'protocols': AttributeDict({}) }) # Test that result gives at least the keys that are listed in `expected` assert not set(expected.keys()).difference(result.keys())