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
f3a3a97a
Commit
f3a3a97a
authored
Jan 10, 2018
by
Martin Reinecke
Browse files
more tests
parent
17013e3d
Pipeline
#23533
passed with stage
in 4 minutes and 34 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_init.py
deleted
100644 → 0
View file @
17013e3d
from
nifty2go
import
*
# This tests if it is possible to import all of Nifty's methods.
# Experience shows this is not always possible.
pass
test/test_operators/test_composed_operator.py
View file @
f3a3a97a
...
...
@@ -61,3 +61,13 @@ class ComposedOperator_Tests(unittest.TestCase):
res
=
full_op
(
x
)
assert_equal
(
isinstance
(
full_op
,
ift
.
DiagonalOperator
),
True
)
assert_allclose
(
ift
.
dobj
.
to_global_data
(
res
.
val
),
432.
)
@
expand
(
product
(
spaces
))
def
test_mix
(
self
,
space
):
op1
=
ift
.
DiagonalOperator
(
ift
.
Field
(
space
,
2.
))
op2
=
ift
.
ScalingOperator
(
3.
,
space
)
full_op
=
op1
*
(
op2
+
op2
)
*
op1
*
op1
-
op1
*
op2
x
=
ift
.
Field
(
space
,
1.
)
res
=
full_op
(
x
)
assert_equal
(
isinstance
(
full_op
,
ift
.
DiagonalOperator
),
True
)
assert_allclose
(
ift
.
dobj
.
to_global_data
(
res
.
val
),
42.
)
test/test_spaces/test_interface.py
View file @
f3a3a97a
...
...
@@ -21,7 +21,7 @@ from numpy.testing import assert_
from
itertools
import
product
from
types
import
LambdaType
from
test.common
import
expand
,
generate_spaces
,
generate_harmonic_spaces
from
nifty2go
import
*
# ugly, but needed for the eval() below
import
nifty2go
as
ift
class
SpaceInterfaceTests
(
unittest
.
TestCase
):
...
...
@@ -34,14 +34,10 @@ class SpaceInterfaceTests(unittest.TestCase):
attr_expected_type
[
1
]))
@
expand
(
product
(
generate_harmonic_spaces
(),
[
[
'get_k_length_array'
,
Field
],
[
'get_k_length_array'
,
ift
.
Field
],
[
'get_fft_smoothing_kernel_function'
,
2.0
,
LambdaType
],
]))
def
test_method_ret_type
(
self
,
space
,
method_expected_type
):
assert_
(
type
(
getattr
(
space
,
method_expected_type
[
0
])(
*
method_expected_type
[
1
:
-
1
]))
is
method_expected_type
[
-
1
])
@
expand
([[
space
]
for
space
in
generate_spaces
()])
def
test_repr
(
self
,
space
):
assert_
(
space
==
eval
(
space
.
__repr__
()))
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