Metadata-Version: 2.5
Name: factory_bot
Version: 0.0.1
Summary: Test data factories with the ergonomics of Ruby's factory_bot
Project-URL: Homepage, https://github.com/dpep/py_factory_bot
Project-URL: Issues, https://github.com/dpep/py_factory_bot/issues
Project-URL: Changelog, https://github.com/dpep/py_factory_bot/blob/main/CHANGELOG.md
Author: Daniel Pepper
License-Expression: MIT
License-File: LICENSE.txt
Keywords: factories,factory_bot,fixtures,testing
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: faker
Provides-Extra: django
Requires-Dist: django; extra == 'django'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy>=2; extra == 'sqlalchemy'
Description-Content-Type: text/markdown

factory_bot
======
Test data factories with the ergonomics of Ruby's [factory_bot](https://github.com/thoughtbot/factory_bot).

Early development: the API is still settling.


### Install
```pip install factory_bot```


### Usage
```python
from factory_bot import build, factory, fake, sequence

@factory(User)
def user(f):
    f.first_name = fake.first_name                    # callables run per build
    f.email = lambda first_name: f"{first_name}@example.com".lower()  # dependencies by name
    f.username = sequence(lambda n: f"user{n}")
    f.admin = False

    @f.trait
    def admin(f):
        f.admin = True

build("user")
# User(first_name='Dennis', email='dennis@example.com', username='user1', admin=False)

build("user", "admin", first_name="Jane")
# User(first_name='Jane', email='jane@example.com', username='user2', admin=True)
```

----
[![installs](https://img.shields.io/pypi/dm/factory_bot?label=installs)](https://pypi.org/project/factory_bot)
