Library to generate instances of Pydantic models.
Project description
Lorem Pysum
Library to generate instances of Pydantic models..
Install
Lorem Pysum is on PyPI and can be installed with:
poetry add lorem-pysum
or
pip install lorem-pysum
Usage
Given a Pydantic model type Lorem Pysum can generate instances of that model with randomly generated values.
Example
from enum import auto, Enum
from uuid import UUID
import lorem_pysum
from pydantic import BaseModel
class Flavor(Enum):
MOCHA = auto()
VANILLA = auto()
class Brand(BaseModel):
brand_name: str
class Coffee(BaseModel):
id: UUID
description: str
cream: bool
sweetener: int
flavor: Flavor
brand: Brand
lorem_pysum.generate(Coffee)
# Result -> Coffee(id=UUID('6cbe3fef-3617-4536-a8af-842221d4105b'), description='laboris', cream=True, sweetener=27, flavor=<Flavor.VANILLA: 2>, brand=Brand(brand_name='non'))
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
lorem-pysum-0.7.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for lorem_pysum-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d337ebcda9fbf7934befd87c15022e188249d3c0a81ff9142e45ea8495917156 |
|
MD5 | dcac81346d0727097c83631ba221f9d1 |
|
BLAKE2b-256 | 4d07b3a73d6af1a0c4101085f17e1a6f77b693281cbf03cf3c224fa555e99e32 |