A package which provides hypothesis strategies for generating beancount types
Project description
beancount-hypothesis
A package which provides hypothesis strategies for generating beancount types.
Usage
Strategies are provided for all of the core types present in beancount
. The
below example generates a random list of directives:
import beancount_hypothesis as h
from hypothesis import given, strategies as s
@given(
s.recursive(
h.balance()
| h.close()
| h.commodity()
| h.custom()
| h.document()
| h.event()
| h.note()
| h.open()
| h.query()
| h.pad()
| h.price()
| h.transaction(),
s.lists,
max_leaves=5,
)
)
Most of the types have restrictions placed on them with the following philosophy:
- The value shouldn't break the
beancount
package - The value should be somewhat authentic (i.e. resemble user data)
Note that the input generated from the strategies is not intended to be passed to any beancount functions. In other words, passing the above example to the loader will result in undefined behavior as it doesn't follow any sensible rules.
Testing
tox
While testing a package meant for tests seems slightly redundant, there are
some custom compositions present that benefit from testing. In most cases the
tests just assert that generating data doesn't raise any exceptions (i.e. break
beancount
in some way).
Contributing
Check out the issues for items needing attention or submit your own and then:
- Fork the repo
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
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
File details
Details for the file beancount-hypothesis-0.1.1.tar.gz
.
File metadata
- Download URL: beancount-hypothesis-0.1.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93b02db78cf3c7eb122554818aa87555b8d63161c2f6bdb287b8ed45e63446ac |
|
MD5 | 9b7b59201d0ecaf0a2c8d739c5a2a424 |
|
BLAKE2b-256 | 3b4e44b1603a3680308ead824ef11b5e72a8c3fe85d3c78119aae490682e0f43 |
File details
Details for the file beancount_hypothesis-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: beancount_hypothesis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc470b4257a02e34826171354cc5b822c7c438fad85ca27fe0f854d3fbc05ac3 |
|
MD5 | 5bcf3c4cf0dee350319befbc7485e733 |
|
BLAKE2b-256 | d8db9f2b82592425b28453e61a7b5645ae805172070fd145e445d7d1df77273b |