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.9.0.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for lorem_pysum-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf78920c27f63e8e77b037d8778b265cba0527fc43b168d29d9e8e7b1f102014 |
|
MD5 | 8f46f81f6996563d23c2b7042222fe4a |
|
BLAKE2b-256 | 900b76f0fb2f819257d3f4a95970f3b8f867bb959722a91ea84bf015f5d7a8c3 |