<commit_before>import json

from click.testing import CliRunner

from populus.project import Project
from populus.migrations.registrar import (
    get_compiled_registrar_contract,
)
from populus.utils.transactions import (
    get_contract_address_from_txn,
    wait_for_unlock,
)
from populus.cli import main


MIGRATION_0001 = ("""
import json
from populus import migrations


class Migration(migrations.Migration):
    migration_id = '0001_deploy_math'
    dependencies = []

    operations = [
        migrations.DeployContract('Math'),
    ]

    compiled_contracts = {{
        'Math': {{
            'code': '{code}',
            'code_runtime': '{code_runtime}',
            'abi': json.loads('{abi}'),
            'source': None,
        }},
    }}
""")


MIGRATION_0002 = ("""
import json
from populus import migrations


class Migration(migrations.Migration):
    migration_id = '0002_increment'
    dependencies = []

    operations = [
        migrations.TransactContract(
            contract_name='Math',
            method_name='increment',
            arguments=[3],
            contract_address=migrations.Address.defer(key='contract/Math'),
            timeout=30,
        ),
    ]

    compiled_contracts = {{
        'Math': {{
            'code': '{code}',
            'code_runtime': '{code_runtime}',
            'abi': json.loads('{abi}'),
            'source': None,
        }},
    }}
""")


def test_migrate_cmd(project_dir, write_project_file, MATH):
    math_code = MATH['code']
    math_runtime = MATH['code_runtime']<commit_msg>fix missing migration dependency in test<commit_after>import json

from click.testing import CliRunner

from populus.project import Project
from populus.migrations.registrar import (
    get_compiled_registrar_contract,
)
from populus.utils.transactions import (
    get_contract_address_from_txn,
    wait_for_unlock,
)
from populus.cli import main


MIGRATION_0001 = ("""
import json
from populus import migrations


class Migration(migrations.Migration):
    migration_id = '0001_deploy_math'
    dependencies = []

    operations = [
        migrations.DeployContract('Math'),
    ]

    compiled_contracts = {{
        'Math': {{
            'code': '{code}',
            'code_runtime': '{code_runtime}',
            'abi': json.loads('{abi}'),
            'source': None,
        }},
    }}
""")


MIGRATION_0002 = ("""
import json
from populus import migrations


class Migration(migrations.Migration):
    migration_id = '0002_increment'
    dependencies = ['0001_deploy_math']

    operations = [
        migrations.TransactContract(
            contract_name='Math',
            method_name='increment',
            arguments=[3],
            contract_address=migrations.Address.defer(key='contract/Math'),
            timeout=30,
        ),
    ]

    compiled_contracts = {{
        'Math': {{
            'code': '{code}',
            'code_runtime': '{code_runtime}',
            'abi': json.loads('{abi}'),
            'source': None,
        }},
    }}
""")


def test_migrate_cmd(project_dir, write_project_file, MATH):
    math_code = MATH['code']
    math_runtime = MATH['code_runtime']
{'fraction_non_alphanumeric': 0.12567098200189453, 'fraction_numerical': 0.013261761919797915, 'mean_word_length': 2.6581986143187066, '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': '5604126', 'n_tokens_mistral': 974, 'n_tokens_neox': 953, 'n_words': 173}