Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
95313ffe
Commit
95313ffe
authored
Mar 20, 2018
by
Martin Reinecke
Browse files
small test cleanups
parent
1cf013f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
test/common.py
View file @
95313ffe
...
...
@@ -18,13 +18,12 @@
from
builtins
import
str
from
parameterized
import
parameterized
import
nifty4
as
ift
import
numpy
as
np
np
.
seterr
(
all
=
'raise'
,
under
=
'ignore'
)
def
custom_name_func
(
testcase_func
,
param_num
,
param
):
def
_
custom_name_func
(
testcase_func
,
param_num
,
param
):
return
"%s_%s"
%
(
testcase_func
.
__name__
,
parameterized
.
to_safe_name
(
"_"
.
join
(
str
(
x
)
for
x
in
param
.
args
)),
...
...
@@ -32,17 +31,5 @@ def custom_name_func(testcase_func, param_num, param):
def
expand
(
*
args
,
**
kwargs
):
return
parameterized
.
expand
(
*
args
,
testcase_func_name
=
custom_name_func
,
return
parameterized
.
expand
(
*
args
,
testcase_func_name
=
_
custom_name_func
,
**
kwargs
)
def
generate_spaces
():
spaces
=
[
ift
.
RGSpace
(
4
),
ift
.
PowerSpace
(
ift
.
RGSpace
((
4
,
4
),
harmonic
=
True
)),
ift
.
LMSpace
(
5
),
ift
.
HPSpace
(
4
),
ift
.
GLSpace
(
4
)]
return
spaces
def
generate_harmonic_spaces
():
spaces
=
[
ift
.
RGSpace
(
4
,
harmonic
=
True
),
ift
.
LMSpace
(
5
)]
return
spaces
test/test_operators/test_composed_operator.py
View file @
95313ffe
...
...
@@ -19,13 +19,14 @@
import
unittest
from
numpy.testing
import
assert_allclose
,
assert_equal
import
nifty4
as
ift
from
test.common
import
generate_spaces
from
itertools
import
product
from
test.common
import
expand
class
ComposedOperator_Tests
(
unittest
.
TestCase
):
spaces
=
generate_spaces
()
spaces
=
[
ift
.
RGSpace
(
4
),
ift
.
PowerSpace
(
ift
.
RGSpace
((
4
,
4
),
harmonic
=
True
)),
ift
.
LMSpace
(
5
),
ift
.
HPSpace
(
4
),
ift
.
GLSpace
(
4
)]
@
expand
(
product
(
spaces
,
spaces
))
def
test_times_adjoint_times
(
self
,
space1
,
space2
):
...
...
test/test_operators/test_diagonal_operator.py
View file @
95313ffe
...
...
@@ -20,13 +20,14 @@ from __future__ import division
import
unittest
from
numpy.testing
import
assert_equal
,
assert_allclose
import
nifty4
as
ift
from
test.common
import
generate_spaces
from
itertools
import
product
from
test.common
import
expand
class
DiagonalOperator_Tests
(
unittest
.
TestCase
):
spaces
=
generate_spaces
()
spaces
=
[
ift
.
RGSpace
(
4
),
ift
.
PowerSpace
(
ift
.
RGSpace
((
4
,
4
),
harmonic
=
True
)),
ift
.
LMSpace
(
5
),
ift
.
HPSpace
(
4
),
ift
.
GLSpace
(
4
)]
@
expand
(
product
(
spaces
))
def
test_property
(
self
,
space
):
...
...
test/test_spaces/test_interface.py
View file @
95313ffe
...
...
@@ -20,12 +20,16 @@ import unittest
from
numpy.testing
import
assert_
from
itertools
import
product
from
types
import
LambdaType
from
test.common
import
expand
,
generate_spaces
,
generate_harmonic_spaces
from
test.common
import
expand
import
nifty4
as
ift
spaces
=
[
ift
.
RGSpace
(
4
),
ift
.
PowerSpace
(
ift
.
RGSpace
((
4
,
4
),
harmonic
=
True
)),
ift
.
LMSpace
(
5
),
ift
.
HPSpace
(
4
),
ift
.
GLSpace
(
4
)]
class
SpaceInterfaceTests
(
unittest
.
TestCase
):
@
expand
(
product
(
generate_
spaces
()
,
[
@
expand
(
product
(
spaces
,
[
[
'harmonic'
,
bool
],
[
'shape'
,
tuple
],
[
'size'
,
int
]]))
...
...
@@ -33,7 +37,7 @@ class SpaceInterfaceTests(unittest.TestCase):
assert_
(
isinstance
(
getattr
(
space
,
attr_expected_type
[
0
]),
attr_expected_type
[
1
]))
@
expand
(
product
(
generate_harmonic_spaces
()
,
[
@
expand
(
product
(
[
ift
.
RGSpace
(
4
,
harmonic
=
True
),
ift
.
LMSpace
(
5
)]
,
[
[
'get_k_length_array'
,
ift
.
Field
],
[
'get_fft_smoothing_kernel_function'
,
2.0
,
LambdaType
],
]))
...
...
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