# tested
General python testing utils
To install: ```pip install tested```
# A little tour...
## validate_codec
Let's start with `validate_codec`, a function to test encoder/decoder pairs.
```python
>>> from tested import validate_codec
```
`pickle.dumps/pickle.loads` is the default encoder/decoder pair.
You can pickle lists, and datetime objects
```python
>>> validate_codec([1, 2, 3])
True
>>> from datetime import datetime
>>> validate_codec(datetime.now())
True
```
But you can't pickle a lambda function
```python
>>> validate_codec(lambda x: x)
False
>>> from functools import partial
>>> import json
>>> validate_jsonability = partial(validate_codec, coder=json.dumps, decoder=json.loads)
```
You can jsonize lists and dicts
```python
>>> assert validate_jsonability([1, 2, 3])
>>> assert validate_jsonability({'a': 1, 'b': {'c': [1, 2, 3]}})
```
You can't jsonize datetime objects
```python
>>> from datetime import datetime
>>> validate_jsonability(datetime.now())
False
```
See [`validate_codec` docs](https://i2mint.github.io/tested/module_docs/tested/codecs.html#tested.codecs.validate_codec)
for more examples.
Raw data
{
"_id": null,
"home_page": "https://github.com/i2mint/tested",
"name": "tested",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "OtoSense",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/2a/4d/0e5a33b3f997c890405dff37f8dd7487b233fb1ffe4596592cdda5cf288f/tested-0.1.22.tar.gz",
"platform": "any",
"description": "# tested\nGeneral python testing utils\n\nTo install:\t```pip install tested```\n\n\n# A little tour...\n\n## validate_codec\n\nLet's start with `validate_codec`, a function to test encoder/decoder pairs.\n\n```python\n>>> from tested import validate_codec\n```\n\n`pickle.dumps/pickle.loads` is the default encoder/decoder pair.\nYou can pickle lists, and datetime objects\n\n```python\n>>> validate_codec([1, 2, 3])\nTrue\n>>> from datetime import datetime\n>>> validate_codec(datetime.now())\nTrue\n```\n\nBut you can't pickle a lambda function\n\n```python\n>>> validate_codec(lambda x: x)\nFalse\n>>> from functools import partial\n>>> import json\n>>> validate_jsonability = partial(validate_codec, coder=json.dumps, decoder=json.loads)\n```\n\nYou can jsonize lists and dicts\n\n```python\n>>> assert validate_jsonability([1, 2, 3])\n>>> assert validate_jsonability({'a': 1, 'b': {'c': [1, 2, 3]}})\n```\n\nYou can't jsonize datetime objects\n\n```python\n>>> from datetime import datetime\n>>> validate_jsonability(datetime.now())\nFalse\n```\n\nSee [`validate_codec` docs](https://i2mint.github.io/tested/module_docs/tested/codecs.html#tested.codecs.validate_codec)\nfor more examples.",
"bugtrack_url": null,
"license": "apache-2.0",
"summary": "Python test utils",
"version": "0.1.22",
"project_urls": {
"Homepage": "https://github.com/i2mint/tested"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a4d0e5a33b3f997c890405dff37f8dd7487b233fb1ffe4596592cdda5cf288f",
"md5": "00e0b6f4d2466054ff888a0172cdd3e4",
"sha256": "c59806772178d62ca27624db6afc0ee6aa3caecaa22a73846134d29385e12cc3"
},
"downloads": -1,
"filename": "tested-0.1.22.tar.gz",
"has_sig": false,
"md5_digest": "00e0b6f4d2466054ff888a0172cdd3e4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17007,
"upload_time": "2023-09-08T14:28:21",
"upload_time_iso_8601": "2023-09-08T14:28:21.032742Z",
"url": "https://files.pythonhosted.org/packages/2a/4d/0e5a33b3f997c890405dff37f8dd7487b233fb1ffe4596592cdda5cf288f/tested-0.1.22.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-08 14:28:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "i2mint",
"github_project": "tested",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tested"
}