import os

from aiohttp.pytest_plugin import pytest_generate_tests

from synthegrator.problem_rendering import render_single_edit_codeproblem_autoregressive
from synthegrator.synthdatasets.apps import yield_apps
import pytest

IN_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"


@pytest.mark.skip(
    reason="This is complaining about remote code. I could probably fix this "
           "but for now we aren't really using this dataset anyways."
)
def test_apps():
    first_apps_example = next(yield_apps(stream_subset=True))
    from pprint import pprint

    expected_text = (
        "An accordion is a string (yes, in the real world accordions are "
        "musical instruments, but let's forget about it for a"
    )
    out = render_single_edit_codeproblem_autoregressive(first_apps_example)
    assert expected_text in out.prompt.text
    assert out.changed_element is not None
    pprint(first_apps_example)


@pytest.mark.skip(
    reason="This is complaining about remote code. I could probably fix this "
           "but for now we aren't really using this dataset anyways."
)
def test_apps_2():
    val = list(yield_appstustream_subset=True)[5]
    assert render_single_edit_codeproblem_autoregressive(val)
