Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
d063029d
Commit
d063029d
authored
3 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Create miniseed_factory fixture within mseed test
parent
c7a942db
No related branches found
No related tags found
2 merge requests
!146
Release CMO metadata to production
,
!138
Locations as Data Types
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/edge_test/MiniSeedFactory_test.py
+11
-7
11 additions, 7 deletions
test/edge_test/MiniSeedFactory_test.py
with
11 additions
and
7 deletions
test/edge_test/MiniSeedFactory_test.py
+
11
−
7
View file @
d063029d
...
@@ -8,6 +8,7 @@ import pytest
...
@@ -8,6 +8,7 @@ import pytest
from
geomagio
import
TimeseriesUtility
from
geomagio
import
TimeseriesUtility
from
geomagio.edge
import
MiniSeedFactory
,
MiniSeedInputClient
from
geomagio.edge
import
MiniSeedFactory
,
MiniSeedInputClient
from
.MockMiniSeedClient
import
MockMiniSeedClient
class
MockMiniSeedInputClient
(
object
):
class
MockMiniSeedInputClient
(
object
):
...
@@ -22,6 +23,14 @@ class MockMiniSeedInputClient(object):
...
@@ -22,6 +23,14 @@ class MockMiniSeedInputClient(object):
self
.
last_sent
=
stream
self
.
last_sent
=
stream
@pytest.fixture
(
scope
=
"
class
"
)
def
miniseed_factory
()
->
MiniSeedFactory
:
"""
instance of MiniSeedFactory with MockMiniseedClient
"""
factory
=
MiniSeedFactory
()
factory
.
client
=
MockMiniSeedClient
()
yield
factory
def
test__put_timeseries
():
def
test__put_timeseries
():
"""
edge_test.MiniSeedFactory_test.test__put_timeseries()
"""
"""
edge_test.MiniSeedFactory_test.test__put_timeseries()
"""
trace1
=
__create_trace
([
0
,
1
,
2
,
3
,
numpy
.
nan
,
5
,
6
,
7
,
8
,
9
],
channel
=
"
H
"
)
trace1
=
__create_trace
([
0
,
1
,
2
,
3
,
numpy
.
nan
,
5
,
6
,
7
,
8
,
9
],
channel
=
"
H
"
)
...
@@ -86,13 +95,11 @@ def test__set_metadata():
...
@@ -86,13 +95,11 @@ def test__set_metadata():
assert_equal
(
stream
[
1
].
stats
[
"
channel
"
],
"
H
"
)
assert_equal
(
stream
[
1
].
stats
[
"
channel
"
],
"
H
"
)
def
test_get_timeseries
(
MockM
ini
S
eed
Client
):
def
test_get_timeseries
(
m
ini
s
eed
_factory
):
"""
edge_test.MiniSeedFactory_test.test_get_timeseries()
"""
"""
edge_test.MiniSeedFactory_test.test_get_timeseries()
"""
# Call get_timeseries, and test stats for comfirmation that it came back.
# Call get_timeseries, and test stats for comfirmation that it came back.
# TODO, need to pass in host and port from a config file, or manually
# TODO, need to pass in host and port from a config file, or manually
# change for a single test.
# change for a single test.
miniseed_factory
=
MiniSeedFactory
()
miniseed_factory
.
client
=
MockMiniSeedClient
()
timeseries
=
miniseed_factory
.
get_timeseries
(
timeseries
=
miniseed_factory
.
get_timeseries
(
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
...
@@ -118,11 +125,8 @@ def test_get_timeseries(MockMiniSeedClient):
...
@@ -118,11 +125,8 @@ def test_get_timeseries(MockMiniSeedClient):
)
)
def
test_get_timeseries_by_location
(
MockM
ini
S
eed
Client
):
def
test_get_timeseries_by_location
(
m
ini
s
eed
_factory
):
"""
test.edge_test.MiniSeedFactory_test.test_get_timeseries_by_location()
"""
"""
test.edge_test.MiniSeedFactory_test.test_get_timeseries_by_location()
"""
miniseed_factory
=
MiniSeedFactory
()
miniseed_factory
.
client
=
MockMiniSeedClient
()
timeseries
=
miniseed_factory
.
get_timeseries
(
timeseries
=
miniseed_factory
.
get_timeseries
(
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
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