Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
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
FINAM
finam
Commits
39b11b83
Commit
39b11b83
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
add tests that data n outputs is a copy of the pushed data
parent
bfddf831
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!217
Ensure data is a copy in outputs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/core/test_sdk.py
+90
-0
90 additions, 0 deletions
tests/core/test_sdk.py
with
90 additions
and
0 deletions
tests/core/test_sdk.py
+
90
−
0
View file @
39b11b83
...
...
@@ -358,6 +358,96 @@ class TestOutput(unittest.TestCase):
with
self
.
assertRaises
(
FinamStaticDataError
):
out
.
push_data
(
0
,
None
)
def
test_data_copied_xarray
(
self
):
t
=
datetime
(
2000
,
1
,
1
)
info
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)))
out
=
Output
(
name
=
"
Output
"
)
in1
=
Input
(
name
=
"
Input
"
)
out
>>
in1
in1
.
ping
()
out
.
push_info
(
info
)
in1
.
exchange_info
(
info
)
in_data
=
fm
.
data
.
full
(
0.0
,
"
test
"
,
info
,
t
)
out
.
push_data
(
in_data
,
t
)
out_data
=
in1
.
pull_data
(
t
,
in1
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
)
in_data
[
0
,
0
,
0
]
=
1.0
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
)
def
test_data_copied_xarray_units
(
self
):
t
=
datetime
(
2000
,
1
,
1
)
info1
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)),
units
=
"
m
"
)
info2
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)),
units
=
"
km
"
)
out
=
Output
(
name
=
"
Output
"
)
in1
=
Input
(
name
=
"
Input
"
)
out
>>
in1
in1
.
ping
()
out
.
push_info
(
info1
)
in1
.
exchange_info
(
info2
)
in_data
=
fm
.
data
.
full
(
0.0
,
"
test
"
,
info1
,
t
)
out
.
push_data
(
in_data
,
t
)
out_data
=
in1
.
pull_data
(
t
,
in1
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
*
fm
.
UNITS
(
"
km
"
))
in_data
[
0
,
0
,
0
]
=
1.0
*
fm
.
UNITS
(
"
m
"
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
*
fm
.
UNITS
(
"
km
"
))
def
test_data_copied_numpy
(
self
):
t
=
datetime
(
2000
,
1
,
1
)
info
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)))
out
=
Output
(
name
=
"
Output
"
)
in1
=
Input
(
name
=
"
Input
"
)
out
>>
in1
in1
.
ping
()
out
.
push_info
(
info
)
in1
.
exchange_info
(
info
)
in_data
=
fm
.
data
.
strip_data
(
fm
.
data
.
full
(
0.0
,
"
test
"
,
info
,
t
))
out
.
push_data
(
in_data
,
t
)
out_data
=
in1
.
pull_data
(
t
,
in1
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
)
in_data
[
0
,
0
]
=
1.0
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
)
def
test_data_copied_numpy_units
(
self
):
t
=
datetime
(
2000
,
1
,
1
)
info1
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)),
units
=
"
m
"
)
info2
=
Info
(
time
=
t
,
grid
=
fm
.
UniformGrid
((
1
,
1
)),
units
=
"
km
"
)
out
=
Output
(
name
=
"
Output
"
)
in1
=
Input
(
name
=
"
Input
"
)
out
>>
in1
in1
.
ping
()
out
.
push_info
(
info1
)
in1
.
exchange_info
(
info2
)
in_data
=
fm
.
data
.
strip_data
(
fm
.
data
.
full
(
0.0
,
"
test
"
,
info1
,
t
))
out
.
push_data
(
in_data
,
t
)
out_data
=
in1
.
pull_data
(
t
,
in1
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
*
fm
.
UNITS
(
"
km
"
))
in_data
[
0
,
0
]
=
1.0
*
fm
.
UNITS
(
"
m
"
)
self
.
assertEqual
(
out_data
[
0
,
0
,
0
],
0.0
*
fm
.
UNITS
(
"
km
"
))
class
TestInput
(
unittest
.
TestCase
):
def
test_fail_set_source
(
self
):
...
...
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