Library to generate instances of Pydantic models.
Project description
Lorem Pysum
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 -> id=UUID('550342d5-13ce-4ee1-b73d-d3c5e81607ce') description='string' cream=True sweetener=0 flavor=<Flavor.MOCHA: 1> brand=Brand(brand_name='string')
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-1.1.1.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for lorem_pysum-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5671ca9ff65dbaf28021ae3bdf6bf4e2dfa44ddf21ee394b6d1236cf474a48b3 |
|
MD5 | 3c1a3ea4e4b65b62f2af654fdf412222 |
|
BLAKE2b-256 | af80b41775ccf67c31d3e4e2b742218cb4352dcb6ee26f22f3d6665f033af529 |