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.1.3.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for lorem_pysum-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec9f4cd4622a32e76a45f57c90a72b9ad56a0eddf6fa7bc1481b508ed1c80720 |
|
MD5 | fdac50d599d0a6aaa8c1eae205edb383 |
|
BLAKE2b-256 | b659f70cbaa0ae77ffe7287606ef160f20eac4709e3e1438414c6296520135dd |