Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Bindgen
pystencils
Commits
a638163a
Commit
a638163a
authored
4 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Corrected datahandling test case
parent
d0a1396b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils_tests/test_datahandling.py
+7
-3
7 additions, 3 deletions
pystencils_tests/test_datahandling.py
with
7 additions
and
3 deletions
pystencils_tests/test_datahandling.py
+
7
−
3
View file @
a638163a
import
os
import
os
from
tempfile
import
TemporaryDirectory
from
tempfile
import
TemporaryDirectory
from
pathlib
import
Path
import
numpy
as
np
import
numpy
as
np
...
@@ -12,6 +13,9 @@ except ImportError:
...
@@ -12,6 +13,9 @@ except ImportError:
import
unittest.mock
import
unittest.mock
pytest
=
unittest
.
mock
.
MagicMock
()
pytest
=
unittest
.
mock
.
MagicMock
()
SCRIPT_FOLDER
=
Path
(
__file__
).
parent
INPUT_FOLDER
=
SCRIPT_FOLDER
/
"
test_data
"
def
basic_iteration
(
dh
):
def
basic_iteration
(
dh
):
dh
.
add_array
(
'
basic_iter_test_gl_default
'
)
dh
.
add_array
(
'
basic_iter_test_gl_default
'
)
...
@@ -321,7 +325,7 @@ def test_save_data():
...
@@ -321,7 +325,7 @@ def test_save_data():
dh
.
add_array
(
"
dst
"
,
values_per_cell
=
9
)
dh
.
add_array
(
"
dst
"
,
values_per_cell
=
9
)
dh
.
fill
(
"
dst
"
,
1.0
,
ghost_layers
=
True
)
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
():
def
test_load_data
():
...
@@ -333,7 +337,7 @@ def test_load_data():
...
@@ -333,7 +337,7 @@ def test_load_data():
dh
.
add_array
(
"
dst
"
,
values_per_cell
=
9
)
dh
.
add_array
(
"
dst
"
,
values_per_cell
=
9
)
dh
.
fill
(
"
dst
"
,
0.0
,
ghost_layers
=
True
)
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
[
'
src
'
])
==
1
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst
'
])
==
1
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst
'
])
==
1
...
@@ -347,7 +351,7 @@ def test_load_data():
...
@@ -347,7 +351,7 @@ def test_load_data():
dh
.
add_array
(
"
dst2
"
,
values_per_cell
=
9
)
dh
.
add_array
(
"
dst2
"
,
values_per_cell
=
9
)
dh
.
fill
(
"
dst2
"
,
0.0
,
ghost_layers
=
True
)
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
[
'
src
'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst
'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst
'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst2
'
])
==
0
assert
np
.
all
(
dh
.
cpu_arrays
[
'
dst2
'
])
==
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment