Beispiel #1
0
def test_auto_test():
    auto_test(my_function)
    auto_test(my_function, auto_verify_=lambda test_call: int(test_call.result))

    with pytest.raises(TypeError):
        auto_test(my_function, number_1=strategies.text())

    with pytest.raises(ValueError):
        auto_test(my_raise_function)
    auto_test(my_raise_function, auto_allow_exceptions_=(ValueError,))
Beispiel #2
0
def test_mkdocs_config():
    auto_test(
        render._mkdocs_config,
        _auto_allow_exceptions=(
            render._mkdocs_exceptions.ConfigurationError, ),
    )
Beispiel #3
0
def test_pdocs_properties():
    auto_test(config.pdocs)
Beispiel #4
0
def test_repository_properties():
    auto_test(config.repository)
Beispiel #5
0
def test_mkdocs_properties():
    auto_test(config.mkdocs)
Beispiel #6
0
def test_toml_properties():
    auto_test(config.toml)
Beispiel #7
0
def test_setup_py_properties():
    auto_test(config.setup_py)
Beispiel #8
0
def test_project_properties(project_dir):
    auto_test(config.project,
              _auto_allow_exceptions=(exceptions.NoProjectFound, ))
    auto_test(config.project,
              directory=project_dir,
              _auto_allow_exceptions=(exceptions.NoProjectFound, ))
import pytest
from utils import providers
from typing import Generator
from hypothesis_auto import auto_pytest_magic as auto_test
import warnings
from hypothesis.errors import NonInteractiveExampleWarning

# ignore hypothesis warnings caused by `.example()` method call
warnings.filterwarnings("ignore", category=NonInteractiveExampleWarning)


@pytest.mark.parametrize(
    "generator,",
    [providers.SpiceGenerator, providers.ServiceGenerator, providers.ObjectGenerator],
)
def test_provider_generates_random_2_part_string(generator: Generator[str, None, None]):
    stringset = [next(generator) for _ in range(0, 50)]
    assert all([isinstance(x, str) for x in stringset])
    assert len(stringset) == len(list(set(stringset)))


auto_test(providers.random_permutations)
auto_test(providers._spice)
auto_test(providers._service)
auto_test(providers._object)
auto_test(providers._news_title)