Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
pymor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
pyMOR
pymor
Commits
348dd196
Commit
348dd196
authored
Apr 14, 2020
by
René Fritze
Committed by
René Fritze
Jun 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tests] fix varray util func imports
parent
0a705fd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
28 deletions
+29
-28
src/pymortests/algorithms/basic.py
src/pymortests/algorithms/basic.py
+2
-2
src/pymortests/strategies.py
src/pymortests/strategies.py
+25
-0
src/pymortests/vectorarray.py
src/pymortests/vectorarray.py
+2
-26
No files found.
src/pymortests/algorithms/basic.py
View file @
348dd196
...
...
@@ -13,8 +13,8 @@ from pymor.operators.constructions import induced_norm
from
pymor.operators.numpy
import
NumpyMatrixOperator
from
pymor.vectorarrays.numpy
import
NumpyVectorSpace
from
pymortests.fixtures.operator
import
operator_with_arrays_and_products
from
pymortests.strategies
import
valid_inds
,
valid_inds_of_same_length
from
pymortests.vectorarray
import
in
valid_ind_pairs
,
in
dexed
from
pymortests.strategies
import
valid_inds
,
valid_inds_of_same_length
,
invalid_ind_pairs
from
pymortests.vectorarray
import
indexed
import
pymortests.strategies
as
pyst
...
...
src/pymortests/strategies.py
View file @
348dd196
...
...
@@ -311,3 +311,28 @@ def vector_arrays_with_ind_pairs_both_lengths(count=1, dtype=None, length=None):
def
equal_tuples
(
draw
,
strategy
,
count
):
val
=
draw
(
strategy
)
return
draw
(
hyst
.
tuples
(
*
[
hyst
.
just
(
val
)
for
_
in
range
(
count
)]))
def
invalid_inds
(
v
,
length
=
None
):
yield
None
if
length
is
None
:
yield
len
(
v
)
yield
[
len
(
v
)]
yield
-
len
(
v
)
-
1
yield
[
-
len
(
v
)
-
1
]
yield
[
0
,
len
(
v
)]
length
=
42
if
length
>
0
:
yield
[
-
len
(
v
)
-
1
]
+
[
0
,
]
*
(
length
-
1
)
yield
list
(
range
(
length
-
1
))
+
[
len
(
v
)]
def
invalid_ind_pairs
(
v1
,
v2
):
for
inds
in
pyst
.
valid_inds_of_different_length
(
v1
,
v2
):
yield
inds
for
ind1
in
pyst
.
valid_inds
(
v1
):
for
ind2
in
invalid_inds
(
v2
,
length
=
v1
.
len_ind
(
ind1
)):
yield
ind1
,
ind2
for
ind2
in
pyst
.
valid_inds
(
v2
):
for
ind1
in
invalid_inds
(
v1
,
length
=
v2
.
len_ind
(
ind2
)):
yield
ind1
,
ind2
\ No newline at end of file
src/pymortests/vectorarray.py
View file @
348dd196
...
...
@@ -7,7 +7,7 @@ from numbers import Number
import
pytest
import
numpy
as
np
from
hypothesis
import
given
,
assume
,
reproduce_failure
,
settings
,
HealthCheck
from
hypothesis
import
given
,
assume
,
settings
,
HealthCheck
from
hypothesis
import
strategies
as
hyst
from
pymor.algorithms.basic
import
almost_equal
...
...
@@ -16,6 +16,7 @@ from pymor.tools import floatcmp
from
pymor.tools.floatcmp
import
float_cmp
from
pymortests.pickling
import
assert_picklable_without_dumps_function
import
pymortests.strategies
as
pyst
from
pymortests.strategies
import
invalid_inds
,
invalid_ind_pairs
def
ind_complement
(
v
,
ind
):
...
...
@@ -40,31 +41,6 @@ def indexed(v, ind):
return
v
[
ind
]
def
invalid_inds
(
v
,
length
=
None
):
yield
None
if
length
is
None
:
yield
len
(
v
)
yield
[
len
(
v
)]
yield
-
len
(
v
)
-
1
yield
[
-
len
(
v
)
-
1
]
yield
[
0
,
len
(
v
)]
length
=
42
if
length
>
0
:
yield
[
-
len
(
v
)
-
1
]
+
[
0
,
]
*
(
length
-
1
)
yield
list
(
range
(
length
-
1
))
+
[
len
(
v
)]
def
invalid_ind_pairs
(
v1
,
v2
):
for
inds
in
pyst
.
valid_inds_of_different_length
(
v1
,
v2
):
yield
inds
for
ind1
in
pyst
.
valid_inds
(
v1
):
for
ind2
in
invalid_inds
(
v2
,
length
=
v1
.
len_ind
(
ind1
)):
yield
ind1
,
ind2
for
ind2
in
pyst
.
valid_inds
(
v2
):
for
ind1
in
invalid_inds
(
v1
,
length
=
v2
.
len_ind
(
ind2
)):
yield
ind1
,
ind2
def
ind_to_list
(
v
,
ind
):
if
type
(
ind
)
is
slice
:
return
list
(
range
(
*
ind
.
indices
(
len
(
v
))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment