Skip to main content

Labrea Test

Utilities for testing code written with labrea

lifecycle PyPI Downloads pre-commit Coverage docs

Installation

labrea-test is available for install via pip.

pip install labrea-test

Alternatively, you can install the latest development version from GitHub.

pip install git+https://github.com/8451/labrea-test@develop

Usage

During testing, you may want to mock a certain dataset (or other Evaluatable) to known value. This can be done using the labrea_test.Mock context manager, which ensures that at the end of the block, any mocking is torn down.

import labrea_test
from labrea import dataset


@dataset
def foo() -> str:
    return "foo"


def test_foo():
    with labrea_test.Mock() as mock:
        mock(foo, "bar")
        assert foo() == "bar"

    assert foo() == "foo"

Mock can be used to mock any Evaluatable object, and can take a plain value or another Evaluatable object as the value to mock to.

@dataset
def bar() -> str:
    return "bar"


def test_foo():
    with labrea_test.Mock() as mock:
        mock(foo, bar)
        assert foo() == "bar"

    assert foo() == "foo"

Contributing

If you would like to contribute to labrea-test, please read the Contributing Guide.

Changelog

A summary of recent updates to labrea-test can be found in the Changelog.

Maintainers

Maintainer Email
Austin Warner austin.warner@8451.com
Michael Stoepel michael.stoepel@8451.com

Metadata

Release files for labrea-test 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labrea-test 0.0.1
File Size Uploaded Provenance Actions
labrea_test-0.0.1.tar.gz 201.1 kB With provenance Details for labrea_test-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for labrea-test 0.0.1
File Interpreter ABI Platform Actions
labrea_test-0.0.1-py3-none-any.whl Python 3 none any Details for labrea_test-0.0.1-py3-none-any.whl

Total release size: 206.6 kB

Release files / labrea_test-0.0.1.tar.gz

Download URL labrea_test-0.0.1.tar.gz
Size 201.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d05801bd6375e83caa9fdb3bec440f43973177a96b09c2fc580ce9a090ace110
BLAKE2b-256 checksum
How to use checksums
a73c1d9665ff4b83e810958e8b0fc1924c14b29fe609dfef176bb6ec24a2eb35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2025.

Transparency log

Release files / labrea_test-0.0.1-py3-none-any.whl

Download URL labrea_test-0.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85358eb2a4749bede32f7e4f6a67a82b12917f1af48534ce4c2e2fe5b896a285
BLAKE2b-256 checksum
How to use checksums
85a8b5ebb00b3828086a692cc2949067180bd82f743a3b36a66e173745bafaff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2025.

Transparency log

Security for labrea-test 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for labrea_test-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page