Commit 03c0c4f8 authored by Hannes Diedrich's avatar Hannes Diedrich
Browse files

Improved testing.

parent 0ea7ca76
Pipeline #1790 passed with stages
in 19 minutes and 49 seconds
......@@ -50,7 +50,7 @@ class Gts2Request(dict):
latrange = ur[1]-ll[1]
lonrange = ur[0]-ll[0]
if (lonrange >= thres) | (latrange >= thres):
raise Exception("Your requestst area too large: ({lon}°x{lat}° excedes 0.2°x0.2°)".format(lat=latrange,
raise ValueError("Your requestst area too large: ({lon}°x{lat}° excedes 0.2°x0.2°)".format(lat=latrange,
lon=lonrange))
def __init__(self, opts, logger=None):
......@@ -824,7 +824,6 @@ def str2bool(v):
if __name__ == "__main__":
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-o", "--out_dir", action="store", required=True, type=str,
help="output_directory")
......@@ -877,7 +876,7 @@ if __name__ == "__main__":
args = parser.parse_args()
if "_" in args.out_prefix:
raise Exception("out_prefix contains '_'. Please use different character, e.g. '-'.")
raise ValueError("out_prefix contains '_'. Please use different character, e.g. '-'.")
suffix = "coreg" if (args.coreg is True) else ""
......
......@@ -195,6 +195,45 @@ class TestGts2Client(unittest.TestCase):
:return:
"""
try:
out_mode = "stack"
print("#### Testing '_' in prefix ")
gts2_client.client(
out_prefix="test_",
out_mode=out_mode,
geo_ll=geo_ll,
geo_ur=geo_ur,
bands="B05",
start_date=start_date,
end_date=end_date,
version=version,
level=level,
max_cloudy=max_cloudy,
minimum_fill=minimum_fill,
stack_resolution=stack_res,
quiet=False)
except ValueError:
print("Test OK.")
try:
out_mode = "stack"
print("#### Testing too large area")
gts2_client.client(
out_mode=out_mode,
geo_ll=geo_ll,
geo_ur=(12.737961+0.2, 53.238058+0.2),
bands="B05",
start_date=start_date,
end_date=end_date,
version=version,
level=level,
max_cloudy=max_cloudy,
minimum_fill=minimum_fill,
stack_resolution=stack_res,
quiet=False)
except ValueError:
print("Test OK.")
try:
out_mode = "python"
print("#### Testing stack_resolution=60")
......@@ -234,7 +273,7 @@ class TestGts2Client(unittest.TestCase):
print("Test OK.")
try:
out_mode = "dowsnotwork"
out_mode = "doesnotwork"
print("#### Testing wrong out_mode")
gts2_client.client(
out_mode=out_mode,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment