Skip to main content

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:

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

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

beancount-hypothesis-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

beancount_hypothesis-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

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

Hashes for beancount-hypothesis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 93b02db78cf3c7eb122554818aa87555b8d63161c2f6bdb287b8ed45e63446ac
MD5 9b7b59201d0ecaf0a2c8d739c5a2a424
BLAKE2b-256 3b4e44b1603a3680308ead824ef11b5e72a8c3fe85d3c78119aae490682e0f43

See more details on using hashes here.

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

Hashes for beancount_hypothesis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc470b4257a02e34826171354cc5b822c7c438fad85ca27fe0f854d3fbc05ac3
MD5 5bcf3c4cf0dee350319befbc7485e733
BLAKE2b-256 d8db9f2b82592425b28453e61a7b5645ae805172070fd145e445d7d1df77273b

See more details on using hashes here.

Supported by

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