Skip to content

Commit

Permalink
clean test
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Feb 26, 2024
1 parent c30fa36 commit 057ee4c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/sources/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,23 @@ def test_constant_3():

date = sample[0].datetime()
date_plus_6h = date + datetime.timedelta(hours=6)
a = load_source("constants", sample, date=date_plus_6h, param="insolation")
b = load_source("constants", sample, date=date, param="insolation+6h")
a = load_source(
"constants", sample, date=date_plus_6h, param="cos_solar_zenith_angle"
)
b = load_source("constants", sample, date=date, param="cos_solar_zenith_angle+6h")
assert np.all(a.to_numpy() == b.to_numpy())
assert a.unique_values("param")["param"] == ("insolation",)
assert b.unique_values("param")["param"] == ("insolation+6h",)
assert a[0].metadata("param") == "cos_solar_zenith_angle"
assert b[0].metadata("param") == "cos_solar_zenith_angle+6h"

date = sample[0].datetime()
date_minus_30d = date + datetime.timedelta(days=-30)
a = load_source("constants", sample, date=date_minus_30d, param="insolation")
b = load_source("constants", sample, date=date, param="insolation-30d")
a = load_source(
"constants", sample, date=date_minus_30d, param="cos_solar_zenith_angle"
)
b = load_source("constants", sample, date=date, param="cos_solar_zenith_angle-30d")
assert np.all(a.to_numpy() == b.to_numpy())
assert a.unique_values("param")["param"] == ("insolation",)
assert b.unique_values("param")["param"] == ("insolation-30d",)
assert a[0].metadata("param") == "cos_solar_zenith_angle"
assert b[0].metadata("param") == "cos_solar_zenith_angle-30d"


if __name__ == "__main__":
Expand Down

0 comments on commit 057ee4c

Please sign in to comment.