@@ -21,13 +21,12 @@ def cmr_dataset(self):
21
21
22
22
def test_full_dataset_processing (self , cmr_dataset ):
23
23
"""Test that all properties can be extracted from real data without errors"""
24
- # Test all property accessors
25
24
assert cmr_dataset .dataset_name == "2000 Pilot Environmental Sustainability Index (ESI)"
26
25
assert cmr_dataset .description .startswith ("The 2000 Pilot Environmental Sustainability Index" )
27
26
assert cmr_dataset .limitations == "None"
28
27
assert cmr_dataset .format == "PDF"
29
- assert cmr_dataset .temporal_extent == "" # No SingleDateTimes in example
30
- assert cmr_dataset .intended_use == "Path A" # ProcessingLevel is 4
28
+ assert cmr_dataset .temporal_extent == "1978-01-01T00:00:00.000Z - 1999-12-31T00:00:00.000Z"
29
+ assert cmr_dataset .intended_use == "Path A"
31
30
assert cmr_dataset .source_link == "https://doi.org/10.7927/H4NK3BZJ"
32
31
assert "Long temporal extent" in cmr_dataset .strengths
33
32
assert "No recent data available" in cmr_dataset .weaknesses
@@ -133,6 +132,62 @@ def test_missing_temporal_data(self):
133
132
assert dataset .temporal_info .latest_end_date is None
134
133
assert dataset .temporal_resolution == ""
135
134
135
+ def test_single_date_only (self ):
136
+ data = {
137
+ "meta" : {},
138
+ "umm" : {"TemporalExtents" : [{"SingleDateTimes" : ["2020-01-01T00:00:00.000Z" , "2020-06-01T00:00:00.000Z" ]}]},
139
+ }
140
+ dataset = CmrDataset (data )
141
+ assert dataset .temporal_extent == "2020-01-01T00:00:00.000Z, 2020-06-01T00:00:00.000Z"
142
+
143
+ def test_range_date_only (self ):
144
+ data = {
145
+ "meta" : {},
146
+ "umm" : {
147
+ "TemporalExtents" : [
148
+ {
149
+ "RangeDateTimes" : [
150
+ {
151
+ "BeginningDateTime" : "2020-01-01T00:00:00.000Z" ,
152
+ "EndingDateTime" : "2020-12-31T23:59:59.999Z" ,
153
+ },
154
+ {
155
+ "BeginningDateTime" : "2021-01-01T00:00:00.000Z" ,
156
+ "EndingDateTime" : "2021-12-31T23:59:59.999Z" ,
157
+ },
158
+ ]
159
+ }
160
+ ]
161
+ },
162
+ }
163
+ dataset = CmrDataset (data )
164
+ assert (
165
+ dataset .temporal_extent
166
+ == "2020-01-01T00:00:00.000Z - 2020-12-31T23:59:59.999Z, 2021-01-01T00:00:00.000Z - 2021-12-31T23:59:59.999Z" # noqa
167
+ )
168
+
169
+ def test_combined_single_and_range_dates (self ):
170
+ data = {
171
+ "meta" : {},
172
+ "umm" : {
173
+ "TemporalExtents" : [
174
+ {
175
+ "SingleDateTimes" : ["2020-01-01T00:00:00.000Z" ],
176
+ "RangeDateTimes" : [
177
+ {
178
+ "BeginningDateTime" : "2021-01-01T00:00:00.000Z" ,
179
+ "EndingDateTime" : "2021-12-31T23:59:59.999Z" ,
180
+ }
181
+ ],
182
+ }
183
+ ]
184
+ },
185
+ }
186
+ dataset = CmrDataset (data )
187
+ assert (
188
+ dataset .temporal_extent == "2020-01-01T00:00:00.000Z, 2021-01-01T00:00:00.000Z - 2021-12-31T23:59:59.999Z"
189
+ )
190
+
136
191
137
192
class TestSpatialProcessing :
138
193
"""Unit tests for spatial information processing"""
0 commit comments