Name | chide JSON |
Version |
3.0.1
JSON |
| download |
home_page | https://github.com/cjw296/chide |
Summary | Quickly create sample objects from data. |
upload_time | 2024-12-05 09:12:45 |
maintainer | None |
docs_url | https://pythonhosted.org/chide/ |
author | Chris Withers |
requires_python | >=3.11 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
Chide
=====
|CircleCI|_ |Docs|_
.. |CircleCI| image:: https://circleci.com/gh/cjw296/chide/tree/master.svg?style=shield
.. _CircleCI: https://circleci.com/gh/cjw296/tree/chide
.. |Docs| image:: https://readthedocs.org/projects/chide/badge/?version=latest
.. _Docs: http://chide.readthedocs.org/en/latest/
Quickly create and compare sample objects.
Chide's philosophy is to give you a simple registry of parameters
needed to instantiate objects for your tests.
There's also support for simplifying objects down to mappings of their attributes
for easier comparison and rendering, along with parsing and rendering of formats
for inserting or asserting about multiple objects that are naturally tabular.
Quickstart
~~~~~~~~~~
Say we have two classes that each require two parameters in order to
be instantiated:
.. code-block:: python
from dataclasses import dataclass
@dataclass
class ClassOne:
x: int
y: int
@dataclass
class ClassTwo:
a: int
b: ClassOne
We can set up a registry of sample values as follows:
.. code-block:: python
from chide import Collection
samples = Collection({
ClassOne: {'x': 1, 'y': 2},
ClassTwo: {'a': 1, 'b': ClassOne},
})
Now we can quickly make sample objects:
>>> samples.make(ClassOne)
ClassOne(x=1, y=2)
We can provide our own overrides if we want:
>>> samples.make(ClassOne, y=3)
ClassOne(x=1, y=3)
We can also create nested trees of objects:
>>> samples.make(ClassTwo)
ClassTwo(a=1, b=ClassOne(x=1, y=2))
Raw data
{
"_id": null,
"home_page": "https://github.com/cjw296/chide",
"name": "chide",
"maintainer": null,
"docs_url": "https://pythonhosted.org/chide/",
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Chris Withers",
"author_email": "chris@withers.org",
"download_url": "https://files.pythonhosted.org/packages/e4/13/95719e846ff26d63603e9752996a1c5bc0ce8bb815710e9f858a3b794522/chide-3.0.1.tar.gz",
"platform": null,
"description": "Chide\n=====\n\n|CircleCI|_ |Docs|_\n\n.. |CircleCI| image:: https://circleci.com/gh/cjw296/chide/tree/master.svg?style=shield\n.. _CircleCI: https://circleci.com/gh/cjw296/tree/chide\n\n.. |Docs| image:: https://readthedocs.org/projects/chide/badge/?version=latest\n.. _Docs: http://chide.readthedocs.org/en/latest/\n\nQuickly create and compare sample objects.\n\nChide's philosophy is to give you a simple registry of parameters\nneeded to instantiate objects for your tests.\nThere's also support for simplifying objects down to mappings of their attributes\nfor easier comparison and rendering, along with parsing and rendering of formats\nfor inserting or asserting about multiple objects that are naturally tabular.\n\nQuickstart\n~~~~~~~~~~\n\nSay we have two classes that each require two parameters in order to\nbe instantiated:\n\n.. code-block:: python\n\n from dataclasses import dataclass\n\n @dataclass\n class ClassOne:\n x: int\n y: int\n\n @dataclass\n class ClassTwo:\n a: int\n b: ClassOne\n\nWe can set up a registry of sample values as follows:\n\n.. code-block:: python\n\n from chide import Collection\n\n samples = Collection({\n ClassOne: {'x': 1, 'y': 2},\n ClassTwo: {'a': 1, 'b': ClassOne},\n })\n\nNow we can quickly make sample objects:\n\n>>> samples.make(ClassOne)\nClassOne(x=1, y=2)\n\nWe can provide our own overrides if we want:\n\n>>> samples.make(ClassOne, y=3)\nClassOne(x=1, y=3)\n\nWe can also create nested trees of objects:\n\n>>> samples.make(ClassTwo)\nClassTwo(a=1, b=ClassOne(x=1, y=2))\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Quickly create sample objects from data.",
"version": "3.0.1",
"project_urls": {
"Homepage": "https://github.com/cjw296/chide"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "011f9c80a9f426ffd4829ac996c8ab108615825721deda39238eed20022bd728",
"md5": "ff01a646e9dfc65b48d02bf3e9724e24",
"sha256": "e4fe9aedd1befb6b51cc655d56f7312f65d59e0a606ed55c7ac9060e100c51ff"
},
"downloads": -1,
"filename": "chide-3.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff01a646e9dfc65b48d02bf3e9724e24",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 11850,
"upload_time": "2024-12-05T09:12:43",
"upload_time_iso_8601": "2024-12-05T09:12:43.724133Z",
"url": "https://files.pythonhosted.org/packages/01/1f/9c80a9f426ffd4829ac996c8ab108615825721deda39238eed20022bd728/chide-3.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e41395719e846ff26d63603e9752996a1c5bc0ce8bb815710e9f858a3b794522",
"md5": "20406e91ad932b3bd444b89a4a11e4dc",
"sha256": "04abfc798fece308acd73660a25dfc2b801de4118af0b11aa28633f2b000f230"
},
"downloads": -1,
"filename": "chide-3.0.1.tar.gz",
"has_sig": false,
"md5_digest": "20406e91ad932b3bd444b89a4a11e4dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 31398,
"upload_time": "2024-12-05T09:12:45",
"upload_time_iso_8601": "2024-12-05T09:12:45.304715Z",
"url": "https://files.pythonhosted.org/packages/e4/13/95719e846ff26d63603e9752996a1c5bc0ce8bb815710e9f858a3b794522/chide-3.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 09:12:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cjw296",
"github_project": "chide",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"circle": true,
"requirements": [],
"lcname": "chide"
}