@@ -183,16 +183,10 @@ def get_ds_to_write_to_disk_validation_result(
183183 vrs = ValidationResultsStore ()
184184
185185 # Metadata that can be validated standalone
186- verification_standalone_l = [
186+ verification_standalone = (
187187 ("creation_date" , validate_creation_date ),
188188 ("tracking_id" , validate_tracking_id ),
189- ]
190- # Optional attributes
191- for optional_attr , verification_func in (("comment" , validate_comment ),):
192- if optional_attr in ds .attrs :
193- verification_standalone_l .append ((optional_attr , verification_func ))
194-
195- verification_standalone = tuple (verification_standalone_l )
189+ )
196190
197191 # Metadata that depends on the data
198192 ds_variables = xr_variable_processor .get_ds_variables (
@@ -227,6 +221,16 @@ def get_ds_to_write_to_disk_validation_result(
227221 func_description = f"Validate the { attribute !r} attribute" ,
228222 )(ds , attribute , validation_function )
229223
224+ # Optional attributes
225+ for attribute_optional , validation_function_optional in (
226+ ("comment" , validate_comment ),
227+ ):
228+ if attribute_optional in ds .attrs :
229+ vrs .wrap (
230+ validate_attribute ,
231+ func_description = f"Validate the { attribute_optional !r} attribute" ,
232+ )(ds , attribute_optional , validation_function_optional )
233+
230234 # Metadata that is defined by the combination of other metadata and the CVs
231235 verification_defined_by_cvs_and_other_metadata = (
232236 (
0 commit comments