From 15653f86370788fa3a87e533d713f0339fbb9e52 Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 9 Apr 2024 11:48:53 -0800 Subject: [PATCH] update test case to work with list in csv cell for gunw product absolute orbit list --- yml_tests/test_known_bugs.yml | 2 ++ yml_tests/test_url_manager.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/yml_tests/test_known_bugs.yml b/yml_tests/test_known_bugs.yml index e05d9af6..a824c049 100644 --- a/yml_tests/test_known_bugs.yml +++ b/yml_tests/test_known_bugs.yml @@ -44,6 +44,8 @@ tests: expected code: 200 #DS-1945 open bug for this +# this is still an issue (FARADAY_ROTATION is labeled as a string type which makes searching via float ranges impossible) +# https://cmr.earthdata.nasa.gov/search/collections.umm_json?attribute[]=FARADAY_ROTATION - maxFaradayRotation: maxFaradayRotation: 3 maxResults: 10 diff --git a/yml_tests/test_url_manager.py b/yml_tests/test_url_manager.py index 173b4cef..61b0ae0f 100644 --- a/yml_tests/test_url_manager.py +++ b/yml_tests/test_url_manager.py @@ -1,3 +1,4 @@ +import ast import requests, urllib # For talking w/ API import json, csv # File stuff import re # Opening/Reading the file stuff @@ -253,7 +254,13 @@ def checkFileContainsExpected(key, test_info, file_dict): if isinstance(poss_list, type([])): expect_type = type(poss_list[0]) # "found_param" is always a string. Convert it to match - if expect_type(found_param) >= poss_list[0] and expect_type(found_param) <= poss_list[1]: + if found_param.startswith('[') and found_param.endswith(']'): + found_param = ast.literal_eval(found_param) + for param in found_param: + if expect_type(param) >= poss_list[0] and expect_type(param) <= poss_list[1]: + found_in_list = True + break + elif expect_type(found_param) >= poss_list[0] and expect_type(found_param) <= poss_list[1]: found_in_list = True break # This part gets hit for single numbers, and strings. (ie "Platform"):