A fork from dataclass-bakery, with a tweak to consider inherited attributes when creating dataclasses.
Project description
Dataclass Bakery
Dataclass Bakery offers you a smart way to create objects based on dataclasses for testing in Python. Inspired in model bakery module for Django.
Install
pip install dataclass_bakery
Usage and Info
Basic usage
from dataclasses import dataclass
from dataclass_bakery import baker
@dataclass
class Customer:
id: int
name: str
spent_money: float
baker.make(Customer)
baker.make(Customer, _quantity=3)
"""
Customer(id=25, name='vzWoIfgoZM', spent_money=16.36)
[Customer(id=27, name='OYvyWakmUX', spent_money=84.98), Customer(id=41, name='AiancdsmLg', spent_money=57.57), Customer(id=92, name='feTxLyuSus', spent_money=26.06)]
"""
For more information: https://dataclass-bakery.readthedocs.io/
Types available:
- int
- str
- float
- bool
- complex
- range
- list
- tuple
- dict
- set
- List (from typing import List)
- Tuple (from typing import Tuple)
- Dict (from typing import Dict)
- Union (from typing import Union)
- Optional (from typing import Optional)
- Path (from pathlib import Path)
- Decimal (from decimal import Decimal)
- UUID (from uuid import UUID)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataclass_bakery_patched-0.6.0.tar.gz.
File metadata
- Download URL: dataclass_bakery_patched-0.6.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
689f786869250e745c6deb97a1d0161d4a5c6856eb01af9be0f3aa47c16cb524
|
|
| MD5 |
e473fda5785d6bfdccf73ae2209fd322
|
|
| BLAKE2b-256 |
3f93701da3321b881b71b78cbea37034dff5728e17ed3c70cefb98b1471bab9e
|
File details
Details for the file dataclass_bakery_patched-0.6.0-py3-none-any.whl.
File metadata
- Download URL: dataclass_bakery_patched-0.6.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b636bcef22fea50cd37b72939fbfc4a5e78df688fe62b0aadd77897e238bbaf
|
|
| MD5 |
1bebba585a526ce0a03513a7233c4067
|
|
| BLAKE2b-256 |
59b3ef241d5f5b7527a957b46741100f81838ec69bfe68ddcbd99060f26ee418
|