<commit_before>import asyncio
from pathlib import Path
from tempfile import NamedTemporaryFile

import pytest

from .. import base


@base.bootstrapped
@pytest.mark.asyncio
async def test_unit_public_address(event_loop):
    async with base.CleanModel() as model:
        app = await model.deploy(
            'cs:ubuntu-0',
            application_name='ubuntu',
            series='trusty',
            channel='stable',
            num_units=2,
        )

        # wait for the units to come up
        await model.block_until(lambda: app.units, timeout=480)

        # make sure we have some units to test with
        assert len(app.units) >= 1

        for unit in app.units:
            addr = await unit.get_public_address(timeout=480)
            assert addr, 'unit public address not set'


@base.bootstrapped
@pytest.mark.asyncio
async def test_run(event_loop):
    from juju.action import Action

    async with base.CleanModel() as model:
        app = await model.deploy(<commit_msg>Update the charm used in the test<commit_after>import asyncio
from pathlib import Path
from tempfile import NamedTemporaryFile

import pytest

from .. import base


@base.bootstrapped
@pytest.mark.asyncio
async def test_unit_public_address(event_loop):
    async with base.CleanModel() as model:
        app = await model.deploy(
            'ch:ubuntu',
            application_name='ubuntu',
            series='bionic',
            channel='stable',
            num_units=2,
        )

        # wait for the units to come up
        await model.block_until(lambda: app.units, timeout=480)

        # make sure we have some units to test with
        assert len(app.units) >= 1

        for unit in app.units:
            addr = await unit.get_public_address(timeout=480)
            assert addr, 'unit public address not set'


@base.bootstrapped
@pytest.mark.asyncio
async def test_run(event_loop):
    from juju.action import Action

    async with base.CleanModel() as model:
        app = await model.deploy(
{'fraction_non_alphanumeric': 0.07894736842105263, 'fraction_numerical': 0.008440913604766634, 'mean_word_length': 2.522727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2989725', 'n_tokens_mistral': 601, 'n_tokens_neox': 571, 'n_words': 179}