Mimesis integration with factory_boy
Project description
mimesis_factory
Description
Mimesis integration for factory_boy
.
Installation
➜ pip install mimesis_factory
Usage
Look at the example below and you’ll understand how it works:
class Account(object):
def __init__(self, username, email, name, surname, age):
self.username = username
self.email = email
self.name = name
self.surname = surname
self.age = age
Now, use the MimesisField
class from mimesis_factory
to define how fake data is generated:
import factory
from mimesis_factory import MimesisField
from account import Account
class AccountFactory(factory.Factory):
class Meta:
model = Account
username = MimesisField('username', template='l_d')
name = MimesisField('name', gender='female')
surname = MimesisField('surname', gender='female')
age = MimesisField('age', minimum=18, maximum=90)
email = factory.LazyAttribute(
lambda o: '%s@example.org' % o.username
)
access_token = MimesisField('token', entropy=32)
pytest
We also recommend to use pytest-factoryboy
.
This way it will be possible to integrate your factories into pytest
fixtures.
License
mimesis_factory is released under the MIT License.
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
mimesis_factory-0.1.0.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file mimesis_factory-0.1.0.tar.gz
.
File metadata
- Download URL: mimesis_factory-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 918656d9cf084b2d55fd75ec5ddd97977fd1371ce2ba4156518b9ddc00e185b9 |
|
MD5 | 645ad9c9b846a890baf655101be9930c |
|
BLAKE2b-256 | b7a2567d485d834f29123e18d3a5f1ba5b43eea29218caa3495a1ed9c2c5f6bf |
File details
Details for the file mimesis_factory-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mimesis_factory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f69f9994395e5309ddd8ed1b2c8012718f14077788c80361cf359718dab8f8f |
|
MD5 | 7d4b90decdb84655be73ccccc58d52e1 |
|
BLAKE2b-256 | 877ef746ecc34ea68d61791cc75d2b6280b5bf3157c6e28bc9867f97d1c79cd1 |