<commit_before># -*- coding: utf-8 -*-
import pytest
from web3 import formatters


@pytest.mark.parametrize(
    "value,expected",
    [
    ('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('00c5496aee77c1ba1f0854206a26dda82a81d6d8', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae', '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae')
    ]
)
def test_input_address_formatter(value, expected):
    assert formatters.input_address_formatter(value) == expected


@pytest.mark.parametrize(
    "value",
    [
    ('0x0c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x0c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('00c5496aee77c1ba1f0854206a26dda82a81d6d'),
    ('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZE'),
    ('0x'),
    ]
)
def test_input_address_formatter_errors(value):
    with pytest.raises(ValueError):
        formatters.input_address_formatter(value)


@pytest.mark.parametrize(
    "value,expected",
    [
    ('latest', 'latest'),
    ('pending', 'pending'),
    ('earliest', 'earliest'),
    (1, '0x1'),
    ('0x1', '0x1')
    ]
)
def test_inputDefaultBlockNumberFormatter(value, expected):
    assert formatters.inputDefaultBlockNumberFormatter(value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [
    ({
        "from": '0x00000',
        "to": '0x00000',
        "payload": '0x7b2274657374223a2274657374227d',
        "ttl": 200,
        "priority": 1000,
        "topics": ['hello','mytopics']
    },
    {
        "from": '0x00000',
        "to": '0x00000',
        "payload": '0x7b2274657374223a2274657374227d',
        "ttl": '0xc8',
        "priority": '0x3e8',
        "topics": ['0x68656c6c6f','0x6d79746f70696373'],
        "workToProve": '0x0'
    })
    ]
)
def test_inputPostFormatter(value, expected):
    assert formatters.inputPostFormatter(value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "nonce": 1000,
            "gas": 1000,
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "nonce": '0x3e8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        }
    ),({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
        }
    ),({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        },
    ), ({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "to": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        },
    ), ({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        }
    )]
)
def test_input_transaction_formatter(value, expected):
    assert formatters.input_transaction_formatter(value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [
        ({
                "hash": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "parentHash": '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                "miner": '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                "stateRoot": '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                "sha3Uncles": '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                "bloom": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "difficulty": '0x3e8',
                "totalDifficulty": '0x3e8',
                "number": '0x3e8',
                "gasLimit": '0x3e8',
                "gasUsed": '0x3e8',
                "timestamp": '0x3e8',
                "extraData": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "nonce": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "size": '0x3e8'
            }, {
                "hash": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "parentHash": '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                "miner": '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                "stateRoot": '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                "sha3Uncles": '<KEY>',<commit_msg>formatter fix<commit_after># -*- coding: utf-8 -*-
import pytest
from web3 import formatters


@pytest.mark.parametrize(
    "value,expected",
    [
    ('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('00c5496aee77c1ba1f0854206a26dda82a81d6d8', '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae', '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae')
    ]
)
def test_input_address_formatter(value, expected):
    assert formatters.input_address_formatter(value) == expected


@pytest.mark.parametrize(
    "value",
    [
    ('0x0c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('0x0c5496aee77c1ba1f0854206a26dda82a81d6d8'),
    ('00c5496aee77c1ba1f0854206a26dda82a81d6d'),
    ('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZE'),
    ('0x'),
    ]
)
def test_input_address_formatter_errors(value):
    with pytest.raises(ValueError):
        formatters.input_address_formatter(value)


@pytest.mark.parametrize(
    "value,expected",
    [
    ('latest', 'latest'),
    ('pending', 'pending'),
    ('earliest', 'earliest'),
    (1, '0x1'),
    ('0x1', '0x1')
    ]
)
def test_inputDefaultBlockNumberFormatter(value, expected):
    assert formatters.inputDefaultBlockNumberFormatter(value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [
    ({
        "from": '0x00000',
        "to": '0x00000',
        "payload": '0x7b2274657374223a2274657374227d',
        "ttl": 200,
        "priority": 1000,
        "topics": ['hello','mytopics']
    },
    {
        "from": '0x00000',
        "to": '0x00000',
        "payload": '0x7b2274657374223a2274657374227d',
        "ttl": '0xc8',
        "priority": '0x3e8',
        "topics": ['0x68656c6c6f','0x6d79746f70696373'],
        "workToProve": '0x0'
    })
    ]
)
def test_inputPostFormatter(value, expected):
    assert formatters.inputPostFormatter(value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "nonce": 1000,
            "gas": 1000,
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "nonce": '0x3e8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        }
    ),({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
        }
    ),({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        },
    ), ({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "to": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "to": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        },
    ), ({
            "data": '0x34234bf23bf4234',
            "value": 100,
            "from": 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
            "gas": '1000',
            "gasPrice": 1000
        },
        {
            "data": '0x34234bf23bf4234',
            "value": '0x64',
            "from": '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
            "gas": '0x3e8',
            "gasPrice": '0x3e8'
        }
    )]
)
def test_input_transaction_formatter(web3_tester, value, expected):
    assert formatters.input_transaction_formatter(web3_tester, value) == expected


@pytest.mark.parametrize(
    "value,expected",
    [
        ({
                "hash": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "parentHash": '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                "miner": '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                "stateRoot": '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                "sha3Uncles": '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                "bloom": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "difficulty": '0x3e8',
                "totalDifficulty": '0x3e8',
                "number": '0x3e8',
                "gasLimit": '0x3e8',
                "gasUsed": '0x3e8',
                "timestamp": '0x3e8',
                "extraData": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "nonce": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "size": '0x3e8'
            }, {
                "hash": '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                "parentHash": '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                "miner": '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                "stateRoot": '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                "sha3Uncles": '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
{'fraction_non_alphanumeric': 0.12367519324248945, 'fraction_numerical': 0.24408319387999045, 'mean_word_length': 2.5714285714285716, 'pattern_counts': {'":': 178, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '799955', 'n_tokens_mistral': 6908, 'n_tokens_neox': 5413, 'n_words': 504}