Utilities for testing code written with labrea.
Project description
Labrea Test
Utilities for testing code written with labrea
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 | |
|---|---|
| Austin Warner | austin.warner@8451.com |
| Michael Stoepel | michael.stoepel@8451.com |
Links
- Report a bug or request a feature: https://github.com/8451/labrea-test/issues/new/choose
- Documentation: https://8451.github.io/labrea-test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d05801bd6375e83caa9fdb3bec440f43973177a96b09c2fc580ce9a090ace110
|
|
| MD5 |
7292583ee3ae0467ce30beae882d68d3
|
|
| BLAKE2b-256 |
a73c1d9665ff4b83e810958e8b0fc1924c14b29fe609dfef176bb6ec24a2eb35
|
Provenance
The following attestation bundles were made for labrea_test-0.0.1.tar.gz:
Publisher:
build-and-deploy.yml on 8451/labrea-test
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
labrea_test-0.0.1.tar.gz -
Subject digest:
d05801bd6375e83caa9fdb3bec440f43973177a96b09c2fc580ce9a090ace110 - Sigstore transparency entry: 208562943
- Sigstore integration time:
-
Permalink:
8451/labrea-test@b567be171557e816e2b5c3f9556289b7e4e9f558 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/8451
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-deploy.yml@b567be171557e816e2b5c3f9556289b7e4e9f558 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85358eb2a4749bede32f7e4f6a67a82b12917f1af48534ce4c2e2fe5b896a285
|
|
| MD5 |
392f611e0cfe3af291b09497feb98350
|
|
| BLAKE2b-256 |
85a8b5ebb00b3828086a692cc2949067180bd82f743a3b36a66e173745bafaff
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
labrea_test-0.0.1-py3-none-any.whl -
Subject digest:
85358eb2a4749bede32f7e4f6a67a82b12917f1af48534ce4c2e2fe5b896a285 - Sigstore transparency entry: 208562945
- Sigstore integration time:
-
Permalink:
8451/labrea-test@b567be171557e816e2b5c3f9556289b7e4e9f558 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/8451
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-deploy.yml@b567be171557e816e2b5c3f9556289b7e4e9f558 -
Trigger Event:
release
-
Statement type: