https://github.com/mar10/fabulist
Generate random strings that make sense.
https://github.com/mar10/fabulist
mock-data python random test-data test-data-generator wordlist-generator
Last synced: about 1 month ago
JSON representation
Generate random strings that make sense.
- Host: GitHub
- URL: https://github.com/mar10/fabulist
- Owner: mar10
- License: mit
- Created: 2017-07-09T18:43:07.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2025-03-06T04:09:34.000Z (7 months ago)
- Last Synced: 2025-04-11T00:44:06.034Z (6 months ago)
- Topics: mock-data, python, random, test-data, test-data-generator, wordlist-generator
- Language: Python
- Homepage: https://fabulist.readthedocs.io/
- Size: 253 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# Fabulist
[](http://sapegin.github.io/powered-by-you/)
[](https://pypi.python.org/pypi/fabulist/)
[](https://github.com/mar10/fabulist/actions/workflows/tests.yml)
[](https://codecov.io/github/mar10/fabulist)
[](https://github.com/mar10/fabulist/blob/master/LICENSE.txt)
[](http://fabulist.readthedocs.io/)
[](https://github.com/mar10/yabs)
[](https://stackoverflow.com/questions/tagged/fabulist)> Generate meaningful test data based on string templates.
## Usage
```
$ pip install fabulist
```then
```py
from fabulist import Fabulistfab = Fabulist()
templates = [
"$(Verb:ing) is better than $(verb:ing).",
"$(Noun:an) a day keeps the $(noun:plural) away.",
"If you want to $(verb) $(adv), $(verb) $(adv)!",
'Confucius says: "The one who wants to $(verb) must $(verb) $(adv) the $(noun)!"',
]
print("Fortune cookies:")
for q in fab.generate_quotes(templates, count=10):
print("- ", q)
```
will produce something like
```
Fortune cookies:
- A statement a day keeps the airports away.
- Savoring is better than magnifying.
- If you want to sate divisively, disuse calmly!
- Praying is better than inspecting.
- Confucius says: "The one who wants to sterilize must inform miserably the possibility!"
- If you want to blur orderly, stride poorly!
- A cost a day keeps the gears away.
- Subtracting is better than worshipping.
- If you want to damage solely, discuss jealously!
- Confucius says: "The one who wants to vanish must swear terribly the punch!"
```See also the [Introduction Slides](https://rawgit.com/mar10/fabulist/master/docs/intro_slides.html)
and [Read The Docs](http://fabulist.readthedocs.org/en/latest/) for details.