Skip to content

Commit

Permalink
test: guess_product_type by dates
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Jun 20, 2024
1 parent f3f76fa commit cd4f90f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/units/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,32 @@ def test_guess_product_type_with_kwargs(self):
actual = self.dag.guess_product_type(productType="foo")
self.assertEqual(actual, ["foo"])

# with dates
self.assertEqual(
self.dag.product_types_config.source["S2_MSI_L1C"]["missionStartDate"],
"2015-06-23T00:00:00Z",
)
self.assertNotIn(
"S2_MSI_L1C", self.dag.guess_product_type(missionEndDate="2015-06-01")
)
self.assertIn(
"S2_MSI_L1C", self.dag.guess_product_type(missionEndDate="2015-07-01")
)
self.assertEqual(
self.dag.product_types_config.source["S2_MSI_L2AP"]["missionStartDate"],
"2017-05-23T00:00:00Z",
)
self.assertEqual(
self.dag.product_types_config.source["S2_MSI_L2AP"]["missionEndDate"],
"2018-03-25T00:00:00Z",
)
self.assertNotIn(
"S2_MSI_L2AP", self.dag.guess_product_type(missionStartDate="2018-04-01")
)
self.assertIn(
"S2_MSI_L2AP", self.dag.guess_product_type(missionStartDate="2018-03-01")
)

def test_guess_product_type_without_kwargs(self):
"""guess_product_type must raise an exception when no kwargs are provided"""
with self.assertRaises(NoMatchingProductType):
Expand Down

0 comments on commit cd4f90f

Please sign in to comment.