Skip to content

Commit

Permalink
deal with some flake8 failures on these files
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaS11 committed Dec 14, 2023
1 parent 7a10277 commit 5cc7ab5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
21 changes: 15 additions & 6 deletions icepyx/tests/test_APIformatting.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest
import warnings
import datetime as dt
from shapely.geometry import Polygon

import icepyx.core.APIformatting as apifmt


# DevNote: is this a situation where you'd ideally build a test class, since you're just repeating the
# test function with different inputs? Especially for the _fmt_spaital, where there's >2 tests?
# DevNote: is this a situation where you'd ideally build a test class,
# since you're just repeating the test function with different inputs?
# Especially for the _fmt_spaital, where there's >2 tests?

# CMR temporal and spatial formats --> what's the best way to compare formatted text? character by character comparison of strings?
# CMR temporal and spatial formats --> what's the best way to compare formatted text?
# character by character comparison of strings?


########## _fmt_temporal ##########
Expand Down Expand Up @@ -46,7 +46,16 @@ def test_var_subset_list_fmt():
"start_delta_time": ["ancillary_data/start_delta_time"],
}
)
exp = "/ancillary_data/atlas_sdp_gps_epoch,/ancillary_data/data_end_utc,/ancillary_data/data_start_utc,/ancillary_data/end_delta_time,/ancillary_data/granule_end_utc,/ancillary_data/granule_start_utc,/profile_2/high_rate/latitude,/profile_2/low_rate/latitude,/orbit_info/sc_orient,/ancillary_data/start_delta_time"
exp = """/ancillary_data/atlas_sdp_gps_epoch,
/ancillary_data/data_end_utc,
/ancillary_data/data_start_utc,
/ancillary_data/end_delta_time,
/ancillary_data/granule_end_utc,
/ancillary_data/granule_start_utc,
/profile_2/high_rate/latitude,
/profile_2/low_rate/latitude,
/orbit_info/sc_orient,
/ancillary_data/start_delta_time"""
assert obs == exp


Expand Down
15 changes: 8 additions & 7 deletions icepyx/tests/test_behind_NSIDC_API_login.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import icepyx as ipx
import os
import json
import pytest
import warnings

import icepyx as ipx
import icepyx.core.is2ref as is2ref


# Misc notes and needed tests
# test avail data and subsetting success for each input type (kml, shp, list of coords, bbox)
# check that downloaded data is subset? or is this an NSIDC level test so long as we verify the right info is submitted?
# test avail data and subsetting success for each input type
# (kml, shp, list of coords, bbox)
# check that downloaded data is subset?
# or is this an NSIDC level test so long as we verify the right info is submitted?


@pytest.fixture(scope="module")
Expand All @@ -26,8 +29,6 @@ def session(reg):


########## is2ref module ##########
import icepyx.core.is2ref as is2ref
import json


def test_get_custom_options_output(session):
Expand Down
8 changes: 4 additions & 4 deletions icepyx/tests/test_granules.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
import re
import requests
import responses
import warnings

import icepyx as ipx
from icepyx.core import granules as granules
Expand All @@ -22,7 +20,8 @@
# check that agent key is added in event of no subsetting


# add test for granules info for ATL11 and ATL13 (and all datasets? or at least ones that don't have the same filename structure)
# add test for granules info for ATL11 and ATL13
# (and all datasets? or at least ones that don't have the same filename structure)
# this example failed in version 0.6.4, leading to a fix in 0.6.5
# short_name = 'ATL11'
# spatial_extent = [-38.65,72.5,-38.40,72.7]
Expand All @@ -31,7 +30,8 @@
# region_a.avail_granules(ids=True)


# DevNote: clearly there's a better way that doesn't make the function so long... what is it?
# DevNote: clearly there's a better way that doesn't make the function so long...
# what is it?
def test_granules_info():
# reg_a = ipx.Query('ATL06', [-55, 68, -48, 71], ['2019-02-20','2019-02-24'], version='3')
# granules = reg_a.granules.avail
Expand Down
2 changes: 0 additions & 2 deletions icepyx/tests/test_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import icepyx as ipx
import pytest
import warnings

# ------------------------------------
# Generic Query tests
Expand Down
6 changes: 4 additions & 2 deletions icepyx/tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def test_check_datasource_type():
[
("./", "is2_local"),
(
"s3://nsidc-cumulus-prod-protected/ATLAS/ATL03/006/2019/11/30/ATL03_20191130221008_09930503_006_01.h5",
"""s3://nsidc-cumulus-prod-protected/ATLAS/
ATL03/006/2019/11/30/ATL03_20191130221008_09930503_006_01.h5""",
"is2_s3",
),
],
Expand Down Expand Up @@ -115,7 +116,8 @@ def test_get_track_type_str(
)


# Best way to test this may be by including a small sample file with the repo (which can be used for testing some of the catalog/read-in functions as well)
# Best way to test this may be by including a small sample file with the repo
# (which can be used for testing some of the catalog/read-in functions as well)
# def test_invalid_filename_pattern_in_file():
# ermesg = "Your input filename does not match the specified pattern."
# default_pattern = Read("/path/to/valid/source/file")._filename_pattern
Expand Down

0 comments on commit 5cc7ab5

Please sign in to comment.