Commit d0549d38 authored by René Fritze's avatar René Fritze Committed by René Fritze

[test] rename the vector_array strategy wrapper again

parent c5e5e3af
......@@ -25,9 +25,9 @@ from pymortests.vectorarray import indexed, assume_old_slicing
import pymortests.strategies as pyst
@pyst.implementations(count=2,
tolerances=hyst.sampled_from([(1e-5, 1e-8), (1e-10, 1e-12), (0., 1e-8), (1e-5, 1e-8)]),
norms=hyst.sampled_from([('sup', np.inf), ('l1', 1), ('l2', 2)]))
@pyst.given_vector_arrays(count=2,
tolerances=hyst.sampled_from([(1e-5, 1e-8), (1e-10, 1e-12), (0., 1e-8), (1e-5, 1e-8)]),
norms=hyst.sampled_from([('sup', np.inf), ('l1', 1), ('l2', 2)]))
def test_almost_equal(vector_arrays, tolerances, norms):
v1, v2 = vector_arrays
rtol, atol = tolerances
......@@ -77,9 +77,9 @@ def test_almost_equal_product(operator_with_arrays_and_products):
<= atol + rtol * norm(v2[ind2])))
@pyst.implementations(count=1, index_strategy=pyst.pairs_same_length,
tolerances=hyst.sampled_from([(1e-5, 1e-8), (1e-10, 1e-12), (0., 1e-8), (1e-5, 1e-8), (1e-12, 0.)]),
norm=hyst.sampled_from(['sup', 'l1', 'l2']))
@pyst.given_vector_arrays(count=1, index_strategy=pyst.pairs_same_length,
tolerances=hyst.sampled_from([(1e-5, 1e-8), (1e-10, 1e-12), (0., 1e-8), (1e-5, 1e-8), (1e-12, 0.)]),
norm=hyst.sampled_from(['sup', 'l1', 'l2']))
@settings(print_blob=True)
def test_almost_equal_self(vectors_and_indices, tolerances, norm):
v, (ind,_) = vectors_and_indices
......@@ -184,7 +184,7 @@ def test_almost_equal_self_product(operator_with_arrays_and_products):
assert not np.all(almost_equal(c[ind], v[ind], atol=atol, rtol=rtol, product=product))
@pyst.implementations(count=2, compatible=False)
@pyst.given_vector_arrays(count=2, compatible=False)
def test_almost_equal_incompatible(vector_arrays):
v1, v2 = vector_arrays
for ind1, ind2 in valid_inds_of_same_length(v1, v2):
......
......@@ -16,7 +16,7 @@ from pymortests.fixtures.operator import operator_with_arrays_and_products
import pymortests.strategies as pyst
@pyst.implementations()
@pyst.given_vector_arrays()
@settings(deadline=20000)
def test_gram_schmidt(vector_array):
U = vector_array
......@@ -36,7 +36,7 @@ def test_gram_schmidt(vector_array):
assert np.all(almost_equal(onb, U))
@pyst.implementations()
@pyst.given_vector_arrays()
@settings(deadline=None)
def test_gram_schmidt_with_R(vector_array):
U = vector_array
......
......@@ -12,13 +12,13 @@ from pymor.algorithms.gram_schmidt import gram_schmidt
from pymor.algorithms.pod import pod
from pymor.algorithms.basic import contains_zero_vector
from pymortests.fixtures.operator import operator_with_arrays_and_products
from pymortests.strategies import vector_arrays, implementations
from pymortests.strategies import vector_arrays, given_vector_arrays
methods = ['method_of_snapshots', 'qr_svd']
@settings(deadline=None)
@implementations(method=sampled_from(methods))
@given_vector_arrays(method=sampled_from(methods))
def test_pod(vector_array, method):
A = vector_array
product = None
......
......@@ -12,12 +12,12 @@ from pymor.algorithms.svd_va import method_of_snapshots, qr_svd
from pymor.algorithms.basic import contains_zero_vector
from pymortests.base import runmodule
from pymortests.fixtures.operator import operator_with_arrays_and_products
from pymortests.strategies import vector_arrays, implementations
from pymortests.strategies import vector_arrays, given_vector_arrays
methods = [method_of_snapshots, qr_svd]
@implementations(method=sampled_from(methods))
@given_vector_arrays(method=sampled_from(methods))
@settings(deadline=None)
def test_method_of_snapshots(vector_array, method):
A = vector_array
......
......@@ -167,7 +167,7 @@ def vector_arrays(draw, space_types, count=1, dtype=None, length=None, compatibl
return ret
def implementations(which='all', count=1, dtype=None, length=None, compatible=True, index_strategy=None, **kwargs):
def given_vector_arrays(which='all', count=1, dtype=None, length=None, compatible=True, index_strategy=None, **kwargs):
"""This decorator hides the combination details of given
the decorated function will be first wrapped in a |hypothesis.given| (with expanded `given_args` and then in
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment