From 5cc7ab501c636579d9a8ee0db98223e275d71119 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 14 Dec 2023 16:22:12 -0500 Subject: [PATCH] deal with some flake8 failures on these files --- icepyx/tests/test_APIformatting.py | 21 +++++++++++++++------ icepyx/tests/test_behind_NSIDC_API_login.py | 15 ++++++++------- icepyx/tests/test_granules.py | 8 ++++---- icepyx/tests/test_query.py | 2 -- icepyx/tests/test_read.py | 6 ++++-- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/icepyx/tests/test_APIformatting.py b/icepyx/tests/test_APIformatting.py index 99855534c..675c78040 100644 --- a/icepyx/tests/test_APIformatting.py +++ b/icepyx/tests/test_APIformatting.py @@ -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 ########## @@ -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 diff --git a/icepyx/tests/test_behind_NSIDC_API_login.py b/icepyx/tests/test_behind_NSIDC_API_login.py index 6e5eb7be2..7df4d0553 100644 --- a/icepyx/tests/test_behind_NSIDC_API_login.py +++ b/icepyx/tests/test_behind_NSIDC_API_login.py @@ -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") @@ -26,8 +29,6 @@ def session(reg): ########## is2ref module ########## -import icepyx.core.is2ref as is2ref -import json def test_get_custom_options_output(session): diff --git a/icepyx/tests/test_granules.py b/icepyx/tests/test_granules.py index 3892f5506..55c29e57e 100644 --- a/icepyx/tests/test_granules.py +++ b/icepyx/tests/test_granules.py @@ -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 @@ -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] @@ -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 diff --git a/icepyx/tests/test_query.py b/icepyx/tests/test_query.py index 38535a985..34f9e1d24 100644 --- a/icepyx/tests/test_query.py +++ b/icepyx/tests/test_query.py @@ -1,6 +1,4 @@ import icepyx as ipx -import pytest -import warnings # ------------------------------------ # Generic Query tests diff --git a/icepyx/tests/test_read.py b/icepyx/tests/test_read.py index a5098143f..67b29b598 100644 --- a/icepyx/tests/test_read.py +++ b/icepyx/tests/test_read.py @@ -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", ), ], @@ -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