beancount-hypothesis-0.1.1
توضیحات
A package which provides hypothesis strategies for generating beancount types
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | beancount-hypothesis-0.1.1 |
| نام | beancount-hypothesis |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Joshua Gilman |
| ایمیل نویسنده | joshuagilman@gmail.com |
| آدرس صفحه اصلی | https://github.com/jmgilman/beancount-hypothesis |
| آدرس اینترنتی | https://pypi.org/project/beancount-hypothesis/ |
| مجوز | MIT |
# beancount-hypothesis
<p align="center">
<a href="https://github.com/jmgilman/beancount-hypothesis/actions/workflows/ci.yml">
<img src="https://github.com/jmgilman/beancount-hypothesis/actions/workflows/ci.yml/badge.svg"/>
</a>
<a href="https://pypi.org/project/beancount-hypothesis">
<img src="https://img.shields.io/pypi/v/beancount-hypothesis"/>
</a>
</p>
> 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:
```python
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
```shell
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][1] for items needing attention or submit your own and
then:
1. [Fork the repo][2]
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
[1]: https://github.com/jmgilman/beancount-hypothesis/issues
[2]: https://github.com/jmgilman/beancount-hypothesis/fork
نیازمندی
| مقدار | نام |
|---|---|
| >=0.3.0,<0.4.0 | RandomWords |
| ==2.3.4 | beancount |
| >=6.36.2,<7.0.0 | hypothesis |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.10,<4.0 | Python |
نحوه نصب
نصب پکیج whl beancount-hypothesis-0.1.1:
pip install beancount-hypothesis-0.1.1.whl
نصب پکیج tar.gz beancount-hypothesis-0.1.1:
pip install beancount-hypothesis-0.1.1.tar.gz