Skip to content

Commit

Permalink
Eliminate print statements from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Oct 11, 2023
1 parent 4d26f64 commit 4592b11
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions tests/test_ProcessGraphDeserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

def test_period_to_intervals():
weekly_intervals = _period_to_intervals("2021-06-08", "2021-06-24", "week")
print(list(weekly_intervals))
weekly_intervals = [(i[0].isoformat(), i[1].isoformat()) for i in weekly_intervals]
assert 3 == len(weekly_intervals)
assert weekly_intervals[0] == ('2021-06-06T00:00:00', '2021-06-13T00:00:00')
Expand Down Expand Up @@ -59,7 +58,6 @@ def test_period_to_intervals_monthly_tz():

def test_period_to_intervals_yearly():
intervals = _period_to_intervals("2018-06-08", "2021-08-24", "year")
print(list(intervals))
intervals = [(i[0].isoformat(), i[1].isoformat()) for i in intervals]
assert 4 == len(intervals)
assert intervals[0] == ('2018-01-01T00:00:00', '2019-01-01T00:00:00')
Expand All @@ -70,7 +68,6 @@ def test_period_to_intervals_yearly():

def test_period_to_intervals_monthly_full_year():
intervals = _period_to_intervals("2020-01-01", "2021-01-01", "month")
print(list(intervals))
intervals = [(i[0].isoformat(), i[1].isoformat()) for i in intervals]
assert 12 == len(intervals)
assert intervals[0] == ('2020-01-01T00:00:00', '2020-02-01T00:00:00')
Expand All @@ -81,7 +78,6 @@ def test_period_to_intervals_monthly_full_year():

def test_period_to_intervals_daily():
intervals = _period_to_intervals("2021-06-08", "2021-06-11", "day")
print(list(intervals))
intervals = [(i[0].isoformat(), i[1].isoformat()) for i in intervals]
assert 4 == len(intervals)
assert intervals[0] == ('2021-06-07T00:00:00', '2021-06-08T00:00:00')
Expand All @@ -92,7 +88,6 @@ def test_period_to_intervals_daily():

def test_period_to_intervals_dekad():
intervals = _period_to_intervals("2021-06-08", "2021-07-20", "dekad")
print(list(intervals))
intervals = [(i[0].isoformat(), i[1].isoformat()) for i in intervals]
assert 5 == len(intervals)
assert intervals[0] == ('2021-06-01T00:00:00', '2021-06-11T00:00:00')
Expand All @@ -104,7 +99,6 @@ def test_period_to_intervals_dekad():

def test_period_to_intervals_dekad_first_of_month():
intervals = _period_to_intervals("2021-06-01", "2021-07-20", "dekad")
print(list(intervals))
intervals = [(i[0].isoformat(), i[1].isoformat()) for i in intervals]
assert 5 == len(intervals)
assert intervals[0] == ('2021-06-01T00:00:00', '2021-06-11T00:00:00')
Expand Down
3 changes: 0 additions & 3 deletions tests/test_save_result_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ def test_aggregate_polygon_result_basic(tmp_path):
assert ["red", "green", "blue"] == [b['name'] for b in theAsset['bands']]

timeseries_ds = xr.open_dataset(filename)
print(timeseries_ds)
assert_array_equal(timeseries_ds.red.coords['t'].data, np.asarray([ np.datetime64('2019-10-15T08:15:45'),np.datetime64('2019-11-11T01:11:11')]))
timeseries_ds.red.sel(feature=1)
timeseries_ds.red.sel( t='2019-10-16')
print(timeseries_ds)
assert_array_equal(
4, timeseries_ds.red.sel(feature=1).sel(t="2019-10-15T08:15:45").data
)
Expand Down Expand Up @@ -146,7 +144,6 @@ def test_aggregate_polygon_result_CSV(tmp_path):
assert 100.0 == theAsset['raster:bands'][0]["statistics"]['valid_percent']

timeseries_ds = xr.open_dataset(filename)
print(timeseries_ds)

assert_array_equal(timeseries_ds.red.coords['t'].data, np.asarray([ np.datetime64('2017-09-05T00:00:00'),np.datetime64('2017-09-06T00:00:00')]))

Expand Down
12 changes: 0 additions & 12 deletions tests/test_views_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,6 @@ def test_process_reference_as_argument(api):
"process_reference_as_argument.json"
)
resp = api.check_result(process_graph)
print(resp.json)


def test_load_collection_without_spatial_extent_incorporates_read_vector_extent(api):
Expand Down Expand Up @@ -2426,8 +2425,6 @@ def test_reduce_dimension(self, api, udp_registry, use_case: _UseCase):
)
udp_registry.save(user_id=TEST_USER, process_id="parameterized_udf", spec=udp)
pg = self._build_process_graph(udp_param="udp_param_123" if use_case.set_udp_parameter else None)
print(f"{udp=})")
print(f"{pg=}")
_ = api.result(pg).assert_status_code(200)

parent_mock: mock.Mock = dummy_backend.get_collection("S2_FOOBAR").reduce_dimension
Expand All @@ -2445,8 +2442,6 @@ def test_apply(self, api, udp_registry, use_case: _UseCase):
udp = self._build_udp(parent="apply", parent_context=use_case.parent_context, udf_context=use_case.udf_context)
udp_registry.save(user_id=TEST_USER, process_id="parameterized_udf", spec=udp)
pg = self._build_process_graph(udp_param="udp_param_123" if use_case.set_udp_parameter else None)
print(f"{udp=})")
print(f"{pg=}")
_ = api.result(pg).assert_status_code(200)

parent_mock: mock.Mock = dummy_backend.get_collection("S2_FOOBAR").apply
Expand All @@ -2464,8 +2459,6 @@ def test_apply_dimension(self, api, udp_registry, use_case: _UseCase):
)
udp_registry.save(user_id=TEST_USER, process_id="parameterized_udf", spec=udp)
pg = self._build_process_graph(udp_param="udp_param_123" if use_case.set_udp_parameter else None)
print(f"{udp=})")
print(f"{pg=}")
_ = api.result(pg).assert_status_code(200)

parent_mock: mock.Mock = dummy_backend.get_collection("S2_FOOBAR").apply_dimension
Expand All @@ -2491,8 +2484,6 @@ def test_apply_neighborhood(self, api, udp_registry, use_case: _UseCase):
)
udp_registry.save(user_id=TEST_USER, process_id="parameterized_udf", spec=udp)
pg = self._build_process_graph(udp_param="udp_param_123" if use_case.set_udp_parameter else None)
print(f"{udp=})")
print(f"{pg=}")
_ = api.result(pg).assert_status_code(200)

parent_mock: mock.Mock = dummy_backend.get_collection("S2_FOOBAR").apply_neighborhood
Expand Down Expand Up @@ -3168,7 +3159,6 @@ def get_props(direction="DESCENDING"):

api.check_result(pg)
params = dummy_backend.all_load_collection_calls("S2_FAPAR_CLOUDCOVER")
print(params)
assert len(params) == 2
assert params[0].properties == properties
assert params[1].properties == asc_props
Expand Down Expand Up @@ -3727,7 +3717,6 @@ def test_request_costs_for_successful_request(api, backend_implementation):
})

assert load_collection.call_count == 1
print(load_collection.call_args)

env = load_collection.call_args[1]["env"]
assert env["correlation_id"] == "r-abc123"
Expand All @@ -3748,7 +3737,6 @@ def test_request_costs_for_failed_request(api, backend_implementation):
}).assert_status_code(500)

assert load_collection.call_count == 1
print(load_collection.call_args)

env = load_collection.call_args[1]["env"]
assert env["correlation_id"] == "r-abc123"
Expand Down

0 comments on commit 4592b11

Please sign in to comment.