# Genuine
Genuine makes it easy to create test data and associations.
It is inspired by ruby factory-bot.
It has a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, and attribute mappings), and support for multiple factories for the same class.
## Installation
```
pip install genuine
```
## Usage
```python
from genuine import build
from dataclasses import dataclass
@dataclass
class User:
name: str
age: int
admin: bool = False
instance = build(User)
assert isinstance(instance, User)
```
With a factory
```python
from genuine import define_factory
with define_factory(User) as factory:
factory.set("name", "John")
instance = build(User)
assert instance.name == "John"
```
Nested model objects
```python
@dataclass
class Comment:
body: str
commenter: User
with define_factory(Comment) as factory:
factory.set("body", "awesome")
factory.association("commenter", User)
assert build(Comment).commenter.name == "John"
```
## Doc
more example are located here https://johnnoone.github.io/genuine/
Raw data
{
"_id": null,
"home_page": "https://johnnoone.github.io/genuine/",
"name": "genuine",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11,<4.0",
"maintainer_email": "",
"keywords": "tests,fixtures",
"author": "Xavier Barbosa",
"author_email": "clint.northwood@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4b/dd/1b10447c1c2351caea4f1a2994a206e46b26f7affd52b80856c5cadaeed3/genuine-0.2.0.tar.gz",
"platform": null,
"description": "# Genuine\n\nGenuine makes it easy to create test data and associations.\nIt is inspired by ruby factory-bot.\n\n\nIt has a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, and attribute mappings), and support for multiple factories for the same class.\n\n\n## Installation\n\n```\npip install genuine\n```\n\n## Usage\n\n```python\nfrom genuine import build\nfrom dataclasses import dataclass\n\n@dataclass\nclass User:\n name: str\n age: int\n admin: bool = False\n\ninstance = build(User)\nassert isinstance(instance, User)\n```\n\nWith a factory\n\n```python\nfrom genuine import define_factory\n\nwith define_factory(User) as factory:\n factory.set(\"name\", \"John\")\n\ninstance = build(User)\nassert instance.name == \"John\"\n```\n\nNested model objects\n\n```python\n@dataclass\nclass Comment:\n body: str\n commenter: User\n\n\nwith define_factory(Comment) as factory:\n factory.set(\"body\", \"awesome\")\n factory.association(\"commenter\", User)\n\nassert build(Comment).commenter.name == \"John\"\n```\n\n\n## Doc\n\nmore example are located here https://johnnoone.github.io/genuine/\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Genuine makes it easy to create test data and associations.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://johnnoone.github.io/genuine/",
"Repository": "https://github.com/johnnoone/genuine"
},
"split_keywords": [
"tests",
"fixtures"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fed8b200a63e9f27d3232a81f67310248874f6ecd559a2f63abf73968ca33c28",
"md5": "4db6b199d98de3cf1f9746d080ccdd9b",
"sha256": "d639ba55ced4827efbc37c45caf04bae657405e08527a2247515b254e16db035"
},
"downloads": -1,
"filename": "genuine-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4db6b199d98de3cf1f9746d080ccdd9b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11,<4.0",
"size": 10118,
"upload_time": "2023-10-28T23:08:12",
"upload_time_iso_8601": "2023-10-28T23:08:12.270978Z",
"url": "https://files.pythonhosted.org/packages/fe/d8/b200a63e9f27d3232a81f67310248874f6ecd559a2f63abf73968ca33c28/genuine-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4bdd1b10447c1c2351caea4f1a2994a206e46b26f7affd52b80856c5cadaeed3",
"md5": "d354e243b9d745dc58a6758d24710f8b",
"sha256": "86f860ea1d2537717f7bcbdf5cf729362db992de8d071a682cec4ff62b546a7b"
},
"downloads": -1,
"filename": "genuine-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "d354e243b9d745dc58a6758d24710f8b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11,<4.0",
"size": 9931,
"upload_time": "2023-10-28T23:08:13",
"upload_time_iso_8601": "2023-10-28T23:08:13.966080Z",
"url": "https://files.pythonhosted.org/packages/4b/dd/1b10447c1c2351caea4f1a2994a206e46b26f7affd52b80856c5cadaeed3/genuine-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-28 23:08:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "johnnoone",
"github_project": "genuine",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "genuine"
}