klen / mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Other
938 stars 96 forks source link

Support for type annotations and TypedDict #166

Open jvllmr opened 2 years ago

jvllmr commented 2 years ago
class Test:
    one: int
    two: int
    name: str

class Scheme:
    name: str
    money: int
    male: bool
    prop: Test

scheme = mixer.blend(Scheme, prop__one=1)
from typing import TypedDict

class Test(TypedDict):
    one: int
    two: int
    name: str

scheme = mixer.blend(Test, name='John') ##{"one": 5, "two": 7, "name": "John"}

Especially support for typed dictionaries would be great for generating test cases. I would like to develop this if other people also find this useful and I have the time.