Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
aa0060d0
Commit
aa0060d0
authored
May 11, 2017
by
Theo Steininger
Browse files
Fixed tests.
parent
061fd215
Pipeline
#12257
failed with stage
in 4 minutes and 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_spaces/test_power_space.py
View file @
aa0060d0
...
...
@@ -28,7 +28,7 @@ from nifty import PowerSpace, RGSpace, Space
from
types
import
NoneType
from
test.common
import
expand
# [harmonic_
domain
, distribution_strategy,
# [harmonic_
partner
, distribution_strategy,
# logarithmic, nbin, binbounds, expected]
CONSTRUCTOR_CONFIGS
=
[
[
1
,
'not'
,
False
,
None
,
None
,
{
'error'
:
ValueError
}],
...
...
@@ -53,7 +53,7 @@ CONSTRUCTOR_CONFIGS = [
'shape'
:
(
2
,),
'dim'
:
2
,
'total_volume'
:
8.0
,
'harmonic_
domain
'
:
RGSpace
((
8
,),
harmonic
=
True
),
'harmonic_
partner
'
:
RGSpace
((
8
,),
harmonic
=
True
),
'log'
:
True
,
'nbin'
:
None
,
'binbounds'
:
None
,
...
...
@@ -94,7 +94,7 @@ def get_weight_configs():
class
PowerSpaceInterfaceTest
(
unittest
.
TestCase
):
@
expand
([
[
'harmonic_
domain
'
,
Space
],
[
'harmonic_
partner
'
,
Space
],
[
'logarithmic'
,
bool
],
[
'nbin'
,
(
int
,
NoneType
)],
[
'binbounds'
,
(
list
,
NoneType
)],
...
...
@@ -112,16 +112,16 @@ class PowerSpaceInterfaceTest(unittest.TestCase):
class
PowerSpaceFunctionalityTest
(
unittest
.
TestCase
):
@
expand
(
CONSTRUCTOR_CONFIGS
)
def
test_constructor
(
self
,
harmonic_
domain
,
distribution_strategy
,
def
test_constructor
(
self
,
harmonic_
partner
,
distribution_strategy
,
logarithmic
,
nbin
,
binbounds
,
expected
):
if
'error'
in
expected
:
with
assert_raises
(
expected
[
'error'
]):
PowerSpace
(
harmonic_
domain
=
harmonic_
domain
,
PowerSpace
(
harmonic_
partner
=
harmonic_
partner
,
distribution_strategy
=
distribution_strategy
,
logarithmic
=
logarithmic
,
nbin
=
nbin
,
binbounds
=
binbounds
)
else
:
p
=
PowerSpace
(
harmonic_
domain
=
harmonic_
domain
,
p
=
PowerSpace
(
harmonic_
partner
=
harmonic_
partner
,
distribution_strategy
=
distribution_strategy
,
logarithmic
=
logarithmic
,
nbin
=
nbin
,
binbounds
=
binbounds
)
...
...
@@ -132,14 +132,14 @@ class PowerSpaceFunctionalityTest(unittest.TestCase):
assert_equal
(
getattr
(
p
,
key
),
value
)
@
expand
(
get_distance_array_configs
())
def
test_distance_array
(
self
,
harmonic_
domain
,
expected
):
p
=
PowerSpace
(
harmonic_
domain
=
harmonic_
domain
)
def
test_distance_array
(
self
,
harmonic_
partner
,
expected
):
p
=
PowerSpace
(
harmonic_
partner
=
harmonic_
partner
)
assert_almost_equal
(
p
.
get_distance_array
(
'not'
),
expected
)
@
expand
(
get_weight_configs
())
def
test_weight
(
self
,
harmonic_
domain
,
x
,
power
,
axes
,
def
test_weight
(
self
,
harmonic_
partner
,
x
,
power
,
axes
,
inplace
,
expected
):
p
=
PowerSpace
(
harmonic_
domain
=
harmonic_
domain
)
p
=
PowerSpace
(
harmonic_
partner
=
harmonic_
partner
)
res
=
p
.
weight
(
x
,
power
,
axes
,
inplace
)
assert_almost_equal
(
res
,
expected
)
if
inplace
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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