tests: fuzzy test for Obs added, test dependencies and documentation

updated.
This commit is contained in:
Fabian Joswig 2023-01-20 11:44:31 +00:00
parent ef23dd256f
commit 7bb164120b
No known key found for this signature in database
5 changed files with 12 additions and 2 deletions

View file

@ -40,6 +40,7 @@ jobs:
pip install pytest pip install pytest
pip install pytest-cov pip install pytest-cov
pip install pytest-benchmark pip install pytest-benchmark
pip install hypothesis
pip install py pip install py
pip freeze pip freeze

View file

@ -25,7 +25,9 @@ For all pull requests tests are executed for the most recent python releases via
pytest -vv --cov=pyerrors pytest -vv --cov=pyerrors
pytest -vv --nbmake examples/*.ipynb pytest -vv --nbmake examples/*.ipynb
``` ```
requiring `pytest`, `pytest-cov`, `pytest-benchmark` and `nbmake`. To get a coverage report in html run requiring `pytest`, `pytest-cov`, `pytest-benchmark`, `hypothesis' and `nbmake`. To install the test dependencies one can run `pip install pyerrors[test]`
To get a coverage report in html run
``` ```
pytest --cov=pyerrors --cov-report html pytest --cov=pyerrors --cov-report html
``` ```

View file

@ -10,6 +10,7 @@ import matplotlib.pyplot as plt
from scipy.stats import skew, skewtest, kurtosis, kurtosistest from scipy.stats import skew, skewtest, kurtosis, kurtosistest
import numdifftools as nd import numdifftools as nd
from itertools import groupby from itertools import groupby
from hypothesis import given, strategies as st
from .covobs import Covobs from .covobs import Covobs
# Improve print output of numpy.ndarrays containing Obs objects. # Improve print output of numpy.ndarrays containing Obs objects.

View file

@ -26,7 +26,7 @@ setup(name='pyerrors',
packages=find_packages(), packages=find_packages(),
python_requires='>=3.7.0', python_requires='>=3.7.0',
install_requires=['numpy>=1.19', 'autograd>=1.5', 'numdifftools>=0.9.41', 'matplotlib>=3.5', 'scipy>=1.7', 'iminuit>=2.17', 'h5py>=3.7', 'lxml>=4.9', 'python-rapidjson>=1.9', 'pandas>=1.1'], install_requires=['numpy>=1.19', 'autograd>=1.5', 'numdifftools>=0.9.41', 'matplotlib>=3.5', 'scipy>=1.7', 'iminuit>=2.17', 'h5py>=3.7', 'lxml>=4.9', 'python-rapidjson>=1.9', 'pandas>=1.1'],
extras_require={'test': ['pytest', 'pytest-cov', 'pytest-benchmark']}, extras_require={'test': ['pytest', 'pytest-cov', 'pytest-benchmark', 'hypothesis']},
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research', 'Intended Audience :: Science/Research',

View file

@ -4,9 +4,15 @@ import copy
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pyerrors as pe import pyerrors as pe
import pytest import pytest
from hypothesis import given, strategies as st
np.random.seed(0) np.random.seed(0)
@given(st.lists(st.floats(allow_nan=False, allow_infinity=False, width=32), min_size=5), st.text())
def test_fuzzy_obs(data, string):
my_obs = pe.Obs([data], [string])
my_obs * my_obs
def test_Obs_exceptions(): def test_Obs_exceptions():
with pytest.raises(Exception): with pytest.raises(Exception):