Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures in test_granules.py #61

Merged
merged 5 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ stages:
jobs:
include:
- stage: basic tests
script: pytest icepyx/tests/test_APIformatting.py
icepyx/tests/test_geospatial.py
icepyx/tests/test_is2ref.py
icepyx/tests/test_validate_inputs.py
script: pytest icepyx/ --ignore icepyx/tests/behind_NSIDC_API_login.py
after_success: codecov

# - stage: behind Earthdata
# script:
# script:
# - export NSIDC_LOGIN=$NSIDC_LOGIN
# - pytest icepyx/tests/behind_NSIDC_API_login.py
20 changes: 8 additions & 12 deletions icepyx/tests/test_granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def test_granules_info():
# reg_a = ipd.Icesat2Data('ATL06', [-55, 68, -48, 71], ['2019-02-20','2019-02-24'], version='3')
# granules = reg_a.granules.avail
granules = [{'producer_granule_id': 'ATL06_20190221121851_08410203_003_01.h5',
grans = [{'producer_granule_id': 'ATL06_20190221121851_08410203_003_01.h5',
'time_start': '2019-02-21T12:19:05.000Z',
'orbit': {'ascending_crossing': '-40.35812957405553',
'start_lat': '59.5',
Expand Down Expand Up @@ -386,29 +386,25 @@ def test_granules_info():
'rel': 'http://esipfed.org/ns/fedsearch/1.1/documentation#',
'hreflang': 'en-US',
'href': 'https://doi.org/10.5067/ATLAS/ATL06.003'}]}]
obs = granules.info(granules)
obs = granules.info(grans)

exp = {'Number of available granules': 2, /
'Average size of granules (MB)': 46.49339485165, /
exp = {'Number of available granules': 2,
'Average size of granules (MB)': 46.49339485165,
'Total size of all granules (MB)': 92.9867897033}

assert obs==exp







def test_no_granules_in_search_results():
ermsg = "Your search returned no results; try different search parameters"
with pytest.raises(AssertionError, match=ermsg):
ipd.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-20'], version='2').avail_granules()


def test_correct_granule_list_returned():
reg_a = ipd.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'], version='2')
reg_a.avail_granules()
obs_grans = [gran['producer_granule_id'] for gran in reg_a.granules]
obs_grans = [gran['producer_granule_id'] for gran in reg_a.granules.avail]
exp_grans = ['ATL06_20190221121851_08410203_002_01.h5', 'ATL06_20190222010344_08490205_002_01.h5', 'ATL06_20190225121032_09020203_002_01.h5', 'ATL06_20190226005526_09100205_002_01.h5']
assert set(obs_grans) == set(exp_grans)

assert set(obs_grans) == set(exp_grans)