<commit_before>import pytest

from raiden.tests.utils.events import must_contain_entry
from raiden.tests.utils.transfer import direct_transfer
from raiden.transfer import views
from raiden.transfer.events import (
    EventTransferSentSuccess,
    EventTransferReceivedSuccess,
)


@pytest.mark.parametrize('channels_per_node', [1])
@pytest.mark.parametrize('number_of_nodes', [2])
@pytest.mark.parametrize('privatekey_seed', ['test_initiator_log_directransfer_success:{}'])
def test_initiator_log_directransfer_success(raiden_chain, token_addresses, deposit):
    app0, app1 = raiden_chain  # pylint: disable=unbalanced-tuple-unpacking
    token_address = token_addresses[0]
    amount = int(deposit / 2.)
    identifier = 7
    token_network_identifier = views.get_token_network_identifier_by_token_address(
        views.state_from_app(app0),
        app0.raiden.default_registry.address,
        token_address,
    )

    direct_transfer(
        app0,
        app1,
        token_network_identifier,
        amount,
        identifier,
    )

    app0_events = app0.raiden.wal.storage.get_events_by_identifier(
        from_identifier=0,
        to_identifier='latest',
    )
    app0_all_events = [event for _, event in app0_events]
    must_contain_entry(app0_all_events, EventTransferSentSuccess, {
        'identifier': identifier,
        'amount': amount,
        'target': app1.raiden.address,
    })

    app1_state_events = app1.raiden.wal.storage.get_events_by_identifier(
        from_identifier=0,
        to_identifier='latest',
    )
    app1_all_events = [event for _, event in app1_state_events]
    must_contain_entry(app1_all_events, EventTransferReceivedSuccess, {
        'identifier': identifier,
        'amount': amount,
        'initiator': app0.raiden.address,
    })<commit_msg>Assert on directtransfer events list<commit_after>import pytest

from raiden.tests.utils.events import must_contain_entry
from raiden.tests.utils.transfer import direct_transfer
from raiden.transfer import views
from raiden.transfer.events import (
    EventTransferSentSuccess,
    EventTransferReceivedSuccess,
)


@pytest.mark.parametrize('channels_per_node', [1])
@pytest.mark.parametrize('number_of_nodes', [2])
@pytest.mark.parametrize('privatekey_seed', ['test_initiator_log_directransfer_success:{}'])
def test_initiator_log_directransfer_success(raiden_chain, token_addresses, deposit):
    app0, app1 = raiden_chain  # pylint: disable=unbalanced-tuple-unpacking
    token_address = token_addresses[0]
    amount = int(deposit / 2.)
    identifier = 7
    token_network_identifier = views.get_token_network_identifier_by_token_address(
        views.state_from_app(app0),
        app0.raiden.default_registry.address,
        token_address,
    )

    direct_transfer(
        app0,
        app1,
        token_network_identifier,
        amount,
        identifier,
    )

    app0_events = app0.raiden.wal.storage.get_events_by_identifier(
        from_identifier=0,
        to_identifier='latest',
    )
    app0_all_events = [event for _, event in app0_events]
    assert must_contain_entry(app0_all_events, EventTransferSentSuccess, {
        'identifier': identifier,
        'amount': amount,
        'target': app1.raiden.address,
    })

    app1_state_events = app1.raiden.wal.storage.get_events_by_identifier(
        from_identifier=0,
        to_identifier='latest',
    )
    app1_all_events = [event for _, event in app1_state_events]
    assert must_contain_entry(app1_all_events, EventTransferReceivedSuccess, {
        'identifier': identifier,
        'amount': amount,
        'initiator': app0.raiden.address,
    })
{'fraction_non_alphanumeric': 0.0908344733242134, 'fraction_numerical': 0.013679890560875513, 'mean_word_length': 3.804204993429698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '14417', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1151, 'n_words': 182}