model-bakery 1.23.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- model_bakery-1.23.0/PKG-INFO +118 -0
- model_bakery-1.23.0/README.md +85 -0
- model_bakery-1.23.0/model_bakery/__init__.py +1 -0
- model_bakery-1.23.0/model_bakery/_types.py +6 -0
- model_bakery-1.23.0/model_bakery/baker.py +964 -0
- model_bakery-1.23.0/model_bakery/content_types.py +14 -0
- model_bakery-1.23.0/model_bakery/exceptions.py +26 -0
- model_bakery-1.23.0/model_bakery/generators.py +161 -0
- model_bakery-1.23.0/model_bakery/gis.py +30 -0
- model_bakery-1.23.0/model_bakery/mock_file.txt +1 -0
- model_bakery-1.23.0/model_bakery/mock_img.jpeg +0 -0
- model_bakery-1.23.0/model_bakery/py.typed +0 -0
- model_bakery-1.23.0/model_bakery/random_gen.py +561 -0
- model_bakery-1.23.0/model_bakery/recipe.py +249 -0
- model_bakery-1.23.0/model_bakery/timezone.py +13 -0
- model_bakery-1.23.0/model_bakery/utils.py +149 -0
- model_bakery-1.23.0/pyproject.toml +126 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: model-bakery
|
|
3
|
+
Version: 1.23.0
|
|
4
|
+
Summary: Smart object creation facility for Django.
|
|
5
|
+
Keywords: django,factory,python,testing
|
|
6
|
+
Author: berin, amureki
|
|
7
|
+
Author-email: berin <bernardoxhc@gmail.com>, amureki <amureki@hey.com>
|
|
8
|
+
License: Apache License 2.0
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Framework :: Django :: 4.2
|
|
12
|
+
Classifier: Framework :: Django :: 5.2
|
|
13
|
+
Classifier: Framework :: Django :: 6.0
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Software Development
|
|
25
|
+
Requires-Dist: django>=4.2
|
|
26
|
+
Requires-Dist: sphinx ; extra == 'docs'
|
|
27
|
+
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
|
28
|
+
Requires-Dist: myst-parser ; extra == 'docs'
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Project-URL: Homepage, https://github.com/model-bakers/model_bakery
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Model Bakery: Smart fixtures for better tests
|
|
35
|
+
|
|
36
|
+
[](https://github.com/model-bakers/model_bakery/actions?workflow=Tests)
|
|
37
|
+
[](https://github.com/model-bakers/model_bakery/actions?workflow=Tests)
|
|
38
|
+
[](https://pypi.python.org/pypi/model_bakery/)
|
|
39
|
+
[](https://model-bakery.readthedocs.io/en/latest/?badge=latest)
|
|
40
|
+
|
|
41
|
+
*Model Bakery* offers you a smart way to create fixtures for testing in Django. With a simple and powerful API, you can create many objects with a single line of code.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install model-bakery
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Supported Versions
|
|
50
|
+
|
|
51
|
+
Model Bakery follows the [Python](https://devguide.python.org/versions/) and [Django](https://docs.djangoproject.com/en/stable/internals/release-process/#supported-versions) release and support cycles. We drop support for Python and Django versions when they reach end-of-life.
|
|
52
|
+
|
|
53
|
+
## Basic usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# models.py
|
|
57
|
+
from django.db import models
|
|
58
|
+
|
|
59
|
+
class Customer(models.Model):
|
|
60
|
+
name = models.CharField(max_length=30)
|
|
61
|
+
email = models.EmailField()
|
|
62
|
+
age = models.IntegerField()
|
|
63
|
+
is_jards_macale_fan = models.BooleanField()
|
|
64
|
+
bio = models.TextField()
|
|
65
|
+
birthday = models.DateField()
|
|
66
|
+
last_shopping = models.DateTimeField()
|
|
67
|
+
|
|
68
|
+
# test_models.py
|
|
69
|
+
from django.test import TestCase
|
|
70
|
+
from model_bakery import baker
|
|
71
|
+
|
|
72
|
+
class TestCustomerModel(TestCase):
|
|
73
|
+
def setUp(self):
|
|
74
|
+
self.customer = baker.make('shop.Customer')
|
|
75
|
+
print(self.customer.__dict__)
|
|
76
|
+
|
|
77
|
+
"""
|
|
78
|
+
{'_state': <django.db.models.base.ModelState object at 0x1129a3240>,
|
|
79
|
+
'age': 3841,
|
|
80
|
+
'bio': 'vUFzMUMyKzlnTyiCxfgODIhrnkjzgQwHtzIbtnVDKflqevczfnaOACkDNqvCHwvtWdLwoiKrCqfppAlogSLECtMmfleeveyqefkGyTGnpbkVQTtviQVDESpXascHAluGHYEotSypSiHvHzFteKIcUebrzUVigiOacfnGdvijEPrZdSCIIBjuXZMaWLrMXyrsUCdKPLRBRYklRdtZhgtxuASXdhNGhDsrnPHrYRClhrSJSVFojMkUHBvSZhoXoCrTfHsAjenCEHvcLeCecsXwXgWJcnJPSFdOmOpiHRnhSgRF',
|
|
81
|
+
'birthday': datetime.date(2019, 12, 3),
|
|
82
|
+
'email': 'rpNATNsxoj@example.com',
|
|
83
|
+
'is_jards_macale_fan': True,
|
|
84
|
+
'id': 1,
|
|
85
|
+
'last_shopping': datetime.datetime(2019, 12, 3, 21, 42, 34, 77019),
|
|
86
|
+
'name': 'qiayYnESvqcYLLBzxpFOcGBIfnQEPx'}
|
|
87
|
+
"""
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
For more detailed information, check out the [full documentation](https://model-bakery.readthedocs.io/).
|
|
93
|
+
|
|
94
|
+
## Contributing
|
|
95
|
+
|
|
96
|
+
As an open-source project, Model Bakery welcomes contributions of many forms:
|
|
97
|
+
|
|
98
|
+
- Code patches
|
|
99
|
+
- Documentation improvements
|
|
100
|
+
- Bug reports
|
|
101
|
+
|
|
102
|
+
Take a look at our [contribution guidelines](CONTRIBUTING.md) for instructions
|
|
103
|
+
on how to set up your local environment.
|
|
104
|
+
|
|
105
|
+
## Maintainers
|
|
106
|
+
|
|
107
|
+
- [Bernardo Fontes](https://github.com/berinhard/)
|
|
108
|
+
- [Rustem Saiargaliev](https://github.com/amureki/)
|
|
109
|
+
- [Tim Klein](https://github.com/timjklein36)
|
|
110
|
+
|
|
111
|
+
## Creator
|
|
112
|
+
|
|
113
|
+
- [Vanderson Mota](https://github.com/vandersonmota/)
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
Model Bakery is licensed under Apache License 2.0.
|
|
118
|
+
See the [LICENSE](LICENSE) file for more information.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Model Bakery: Smart fixtures for better tests
|
|
2
|
+
|
|
3
|
+
[](https://github.com/model-bakers/model_bakery/actions?workflow=Tests)
|
|
4
|
+
[](https://github.com/model-bakers/model_bakery/actions?workflow=Tests)
|
|
5
|
+
[](https://pypi.python.org/pypi/model_bakery/)
|
|
6
|
+
[](https://model-bakery.readthedocs.io/en/latest/?badge=latest)
|
|
7
|
+
|
|
8
|
+
*Model Bakery* offers you a smart way to create fixtures for testing in Django. With a simple and powerful API, you can create many objects with a single line of code.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install model-bakery
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Supported Versions
|
|
17
|
+
|
|
18
|
+
Model Bakery follows the [Python](https://devguide.python.org/versions/) and [Django](https://docs.djangoproject.com/en/stable/internals/release-process/#supported-versions) release and support cycles. We drop support for Python and Django versions when they reach end-of-life.
|
|
19
|
+
|
|
20
|
+
## Basic usage
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
# models.py
|
|
24
|
+
from django.db import models
|
|
25
|
+
|
|
26
|
+
class Customer(models.Model):
|
|
27
|
+
name = models.CharField(max_length=30)
|
|
28
|
+
email = models.EmailField()
|
|
29
|
+
age = models.IntegerField()
|
|
30
|
+
is_jards_macale_fan = models.BooleanField()
|
|
31
|
+
bio = models.TextField()
|
|
32
|
+
birthday = models.DateField()
|
|
33
|
+
last_shopping = models.DateTimeField()
|
|
34
|
+
|
|
35
|
+
# test_models.py
|
|
36
|
+
from django.test import TestCase
|
|
37
|
+
from model_bakery import baker
|
|
38
|
+
|
|
39
|
+
class TestCustomerModel(TestCase):
|
|
40
|
+
def setUp(self):
|
|
41
|
+
self.customer = baker.make('shop.Customer')
|
|
42
|
+
print(self.customer.__dict__)
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
{'_state': <django.db.models.base.ModelState object at 0x1129a3240>,
|
|
46
|
+
'age': 3841,
|
|
47
|
+
'bio': 'vUFzMUMyKzlnTyiCxfgODIhrnkjzgQwHtzIbtnVDKflqevczfnaOACkDNqvCHwvtWdLwoiKrCqfppAlogSLECtMmfleeveyqefkGyTGnpbkVQTtviQVDESpXascHAluGHYEotSypSiHvHzFteKIcUebrzUVigiOacfnGdvijEPrZdSCIIBjuXZMaWLrMXyrsUCdKPLRBRYklRdtZhgtxuASXdhNGhDsrnPHrYRClhrSJSVFojMkUHBvSZhoXoCrTfHsAjenCEHvcLeCecsXwXgWJcnJPSFdOmOpiHRnhSgRF',
|
|
48
|
+
'birthday': datetime.date(2019, 12, 3),
|
|
49
|
+
'email': 'rpNATNsxoj@example.com',
|
|
50
|
+
'is_jards_macale_fan': True,
|
|
51
|
+
'id': 1,
|
|
52
|
+
'last_shopping': datetime.datetime(2019, 12, 3, 21, 42, 34, 77019),
|
|
53
|
+
'name': 'qiayYnESvqcYLLBzxpFOcGBIfnQEPx'}
|
|
54
|
+
"""
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
For more detailed information, check out the [full documentation](https://model-bakery.readthedocs.io/).
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
As an open-source project, Model Bakery welcomes contributions of many forms:
|
|
64
|
+
|
|
65
|
+
- Code patches
|
|
66
|
+
- Documentation improvements
|
|
67
|
+
- Bug reports
|
|
68
|
+
|
|
69
|
+
Take a look at our [contribution guidelines](CONTRIBUTING.md) for instructions
|
|
70
|
+
on how to set up your local environment.
|
|
71
|
+
|
|
72
|
+
## Maintainers
|
|
73
|
+
|
|
74
|
+
- [Bernardo Fontes](https://github.com/berinhard/)
|
|
75
|
+
- [Rustem Saiargaliev](https://github.com/amureki/)
|
|
76
|
+
- [Tim Klein](https://github.com/timjklein36)
|
|
77
|
+
|
|
78
|
+
## Creator
|
|
79
|
+
|
|
80
|
+
- [Vanderson Mota](https://github.com/vandersonmota/)
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
Model Bakery is licensed under Apache License 2.0.
|
|
85
|
+
See the [LICENSE](LICENSE) file for more information.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .utils import seq # NoQA
|