-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit tests for the new NoRP support functions and a data file to test mock downloads for the new Instrument.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TYKW-NoRP solar daily flux (1951-11-02 -- 1951-11-06) | ||
Date,1 GHz,2 GHz,3.75 GHz,9.4 GHz | ||
"1951-11-02",NaN,NaN,NaN,NaN | ||
"1951-11-03",NaN,NaN,NaN,NaN | ||
"1951-11-04",NaN,NaN,NaN,NaN | ||
"1951-11-05",NaN,NaN,NaN,NaN | ||
"1951-11-06",NaN,NaN,115.000,NaN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env python | ||
# Full license can be found in License.md | ||
# Full author list can be found in .zenodo.json file | ||
# DOI:10.5281/zenodo.3986138 | ||
# ---------------------------------------------------------------------------- | ||
"""Integration and unit test suite for NoRP methods.""" | ||
|
||
import pytest | ||
|
||
from pysatSpaceWeather.instruments.methods import norp as mm_norp | ||
|
||
|
||
class TestNoRPMethods(object): | ||
"""Test class for NoRP methods.""" | ||
|
||
def setup_method(self): | ||
"""Create a clean testing setup.""" | ||
self.out = None | ||
return | ||
|
||
def teardown_method(self): | ||
"""Clean up previous testing setup.""" | ||
del self.out | ||
return | ||
|
||
def test_acknowledgements(self): | ||
"""Test the NoRP acknowledgements.""" | ||
self.out = mm_norp.acknowledgements() | ||
assert self.out.find('NoRP') >= 0 | ||
return | ||
|
||
@pytest.mark.parametrize('name,tag', [('rf', 'daily')]) | ||
def test_references(self, name, tag): | ||
"""Test the references for a NoRP instrument. | ||
Parameters | ||
---------- | ||
name : str | ||
Instrument name | ||
tag : str | ||
Instrument tag | ||
""" | ||
self.out = mm_norp.references(name, tag) | ||
assert self.out.find('Toyokawa Observatory') > 0 | ||
return | ||
|
||
def test_references_bad_name(self): | ||
"""Test the references raise an informative error for bad instrument.""" | ||
with pytest.raises(KeyError) as kerr: | ||
mm_norp.references('ace', 'sis') | ||
|
||
assert str(kerr.value).find('ace') >= 0, \ | ||
"Unknown KeyError message: {:}".format(kerr.value) | ||
return |