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
Sebastian Bindgen
pystencils
Commits
a638163a
Commit
a638163a
authored
Aug 09, 2020
by
Markus Holzer
Browse files
Corrected datahandling test case
parent
d0a1396b
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils_tests/test_datahandling.py
View file @
a638163a
import
os
from
tempfile
import
TemporaryDirectory
from
pathlib
import
Path
import
numpy
as
np
...
...
@@ -12,6 +13,9 @@ except ImportError:
import
unittest.mock
pytest
=
unittest
.
mock
.
MagicMock
()
SCRIPT_FOLDER
=
Path
(
__file__
).
parent
INPUT_FOLDER
=
SCRIPT_FOLDER
/
"test_data"
def
basic_iteration
(
dh
):
dh
.
add_array
(
'basic_iter_test_gl_default'
)
...
...
@@ -321,7 +325,7 @@ def test_save_data():
dh
.
add_array
(
"dst"
,
values_per_cell
=
9
)
dh
.
fill
(
"dst"
,
1.0
,
ghost_layers
=
True
)
dh
.
save_all
(
'test_data
/datahandling_save_test'
)
dh
.
save_all
(
INPUT_FOLDER
.
name
+
'
/datahandling_save_test'
)
def
test_load_data
():
...
...
@@ -333,7 +337,7 @@ def test_load_data():
dh
.
add_array
(
"dst"
,
values_per_cell
=
9
)
dh
.
fill
(
"dst"
,
0.0
,
ghost_layers
=
True
)
dh
.
load_all
(
'test_data
/datahandling_load_test'
)
dh
.
load_all
(
INPUT_FOLDER
.
name
+
'
/datahandling_load_test'
)
assert
np
.
all
(
dh
.
cpu_arrays
[
'src'
])
==
1
assert
np
.
all
(
dh
.
cpu_arrays
[
'dst'
])
==
1
...
...
@@ -347,7 +351,7 @@ def test_load_data():
dh
.
add_array
(
"dst2"
,
values_per_cell
=
9
)
dh
.
fill
(
"dst2"
,
0.0
,
ghost_layers
=
True
)
dh
.
load_all
(
'test_data
/datahandling_load_test'
)
dh
.
load_all
(
INPUT_FOLDER
.
name
+
'
/datahandling_load_test'
)
assert
np
.
all
(
dh
.
cpu_arrays
[
'src'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'dst'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'dst2'
])
==
0
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