<commit_before>import pytest
from approvaltests import verify, get_scenario_namer
from approvaltests.namer import NamerFactory
from approvaltests.utilities.exceptions.exception_collector import gather_all_exceptions, \
    gather_all_exceptions_and_throw


def is_leap(year: int) -> bool:
    if year % 400 == 0:
        return True
    if year % 100 == 0:
        return False
    return year % 4 == 0


@pytest.mark.parametrize("year", [1993, 1992, 1900, 2000])
def test_scenarios_old(year: int) -> None:
    verify(
        "is Leap " + str(year) + ": " + str(is_leap(year)),
        namer=get_scenario_namer(year),
    )


# begin-snippet: parametrized-test-example
@pytest.mark.parametrize("year", [1993, 1992, 1900, 2000])
def test_scenarios(year: int) -> None:
    verify(f"is Leap {str(year)}: {str(is_leap(year))}", options=NamerFactory.with_parameters(year))
# end-snippet


def test_manual_scenarios() -> None:
    # begin-snippet: multiple-verifies-without-blocking
    gather_all_exceptions_and_throw([1, 2], lambda i: verify(f"{i}", options=NamerFactory.with_parameters(i)))
    # end-snippet<commit_msg>R!! extract variable<commit_after>import pytest
from approvaltests import verify, get_scenario_namer
from approvaltests.namer import NamerFactory
from approvaltests.utilities.exceptions.exception_collector import gather_all_exceptions, \
    gather_all_exceptions_and_throw


def is_leap(year: int) -> bool:
    if year % 400 == 0:
        return True
    if year % 100 == 0:
        return False
    return year % 4 == 0


@pytest.mark.parametrize("year", [1993, 1992, 1900, 2000])
def test_scenarios_old(year: int) -> None:
    verify(
        "is Leap " + str(year) + ": " + str(is_leap(year)),
        namer=get_scenario_namer(year),
    )


# begin-snippet: parametrized-test-example
@pytest.mark.parametrize("year", [1993, 1992, 1900, 2000])
def test_scenarios(year: int) -> None:
    verify(f"is Leap {str(year)}: {str(is_leap(year))}", options=NamerFactory.with_parameters(year))
# end-snippet


def test_manual_scenarios() -> None:
    # begin-snippet: multiple-verifies-without-blocking
    inputs = [1, 2]
    gather_all_exceptions_and_throw(inputs, lambda i: verify(f"{i}", options=NamerFactory.with_parameters(i)))
    # end-snippet

{'fraction_non_alphanumeric': 0.12853356890459364, 'fraction_numerical': 0.038869257950530034, 'mean_word_length': 4.380047505938243, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, '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': '1745021', 'n_tokens_mistral': 872, 'n_tokens_neox': 783, 'n_words': 163}