Metadata-Version: 2.4
Name: tested
Version: 0.1.25
Summary: Python test utils
Project-URL: Homepage, https://github.com/i2mint/tested
Author: Thor Whalen
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: codecs,doctest,machine-learning,pytest,testing,utils
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: i2
Requires-Dist: numpy
Requires-Dist: scikit-learn
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-rtd-theme>=1.0; extra == 'docs'
Requires-Dist: sphinx>=6.0; extra == 'docs'
Description-Content-Type: text/markdown

# 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.

