Skip to main content

Utilities for testing code written with labrea.

Project description

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

Links

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

labrea_test-0.0.1.tar.gz (201.1 kB view details)

Uploaded Source

Built Distribution

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

labrea_test-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file labrea_test-0.0.1.tar.gz.

File metadata

  • Download URL: labrea_test-0.0.1.tar.gz
  • Upload date:
  • Size: 201.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for labrea_test-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d05801bd6375e83caa9fdb3bec440f43973177a96b09c2fc580ce9a090ace110
MD5 7292583ee3ae0467ce30beae882d68d3
BLAKE2b-256 a73c1d9665ff4b83e810958e8b0fc1924c14b29fe609dfef176bb6ec24a2eb35

See more details on using hashes here.

Provenance

The following attestation bundles were made for labrea_test-0.0.1.tar.gz:

Publisher: build-and-deploy.yml on 8451/labrea-test

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file labrea_test-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: labrea_test-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for labrea_test-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85358eb2a4749bede32f7e4f6a67a82b12917f1af48534ce4c2e2fe5b896a285
MD5 392f611e0cfe3af291b09497feb98350
BLAKE2b-256 85a8b5ebb00b3828086a692cc2949067180bd82f743a3b36a66e173745bafaff

See more details on using hashes here.

Provenance

The following attestation bundles were made for labrea_test-0.0.1-py3-none-any.whl:

Publisher: build-and-deploy.yml on 8451/labrea-test

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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