Skip to main content

pytest plugin integrating pydantic-evals

Project description

pytest-pyeval

A pytest plugin integrating pydantic-evals

Run evals via pytest with the power of fixtures and using a familiar Arrange, Act, Evaluate pattern.

Example

from pyeval import dataset, Case, EqualsExpected, Contains


def uppercase_text(text: str) -> str:
    return text.upper()


@dataset(
    Case(
        name="uppercase_basic",
        inputs="hello world",
        expected_output="HELLO WORLD",
    ),
    Case(
        name="uppercase_with_numbers",
        inputs="hello 123",
        expected_output="HELLO 123",
    ),
)
def eval_uppercase(case: Case):
    result = execute(uppercase_text, case)

    result.evaluate(EqualsExpected())
    result.evaluate(Contains(value="HELLO", case_sensitive=True))
$ uv run pytest

============================== test session starts ==============================
platform darwin -- Python 3.13.1, pytest-9.0.2, pluggy-1.6.0
plugins: anyio-4.12.1, pyeval-0.1.0
collected 2 items

tests/evals/eval_example.py ●●                                                                         [100%]

============================= 2 evaluated in 0.02s ==============================

Installation

uv add --dev pytest-pyeval

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_pyeval-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_pyeval-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_pyeval-0.2.0.tar.gz.

File metadata

  • Download URL: pytest_pyeval-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pytest_pyeval-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8ff9bb35b448b2d0aef02499936151b74394da3aec4618484f3df9562d9e1002
MD5 0e9effe401312c10c5834a5a65cf6b66
BLAKE2b-256 4cdcc3af45eaf0e7a2429a602cf07ccd202b1b24804422fdb9f38521250065e9

See more details on using hashes here.

File details

Details for the file pytest_pyeval-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_pyeval-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pytest_pyeval-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5b7456048e8a533209cd2913fd267cdf96afc5fed4a55455ae2654f9aa7c0f3
MD5 b82df4e0c76470600dd35b97b7dc2b28
BLAKE2b-256 29886972b12f3a163db34c263e3ca8c6d5339a58acd70eca7a096c99111fc269

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page