88import xarray as xr
99
1010from xrlint .config import Config , ConfigObject
11- from xrlint .constants import CORE_PLUGIN_NAME , NODE_ROOT_NAME
11+ from xrlint .constants import CORE_PLUGIN_NAME , DATASET_ROOT_NAME
1212from xrlint .linter import Linter , new_linter
1313from xrlint .node import AttrNode , AttrsNode , DatasetNode , VariableNode
1414from xrlint .plugin import new_plugin
@@ -179,7 +179,7 @@ def test_linter_respects_rule_severity_error(self):
179179 messages = [
180180 Message (
181181 message = "Dataset does not have data variables" ,
182- node_path = "dataset" ,
182+ node_path = DATASET_ROOT_NAME ,
183183 rule_id = "test/dataset-without-data-vars" ,
184184 severity = 2 ,
185185 )
@@ -204,7 +204,7 @@ def test_linter_respects_rule_severity_warn(self):
204204 messages = [
205205 Message (
206206 message = "Dataset does not have data variables" ,
207- node_path = "dataset" ,
207+ node_path = DATASET_ROOT_NAME ,
208208 rule_id = "test/dataset-without-data-vars" ,
209209 severity = 1 ,
210210 )
@@ -238,7 +238,7 @@ def test_linter_recognized_unknown_rule(self):
238238 Message (
239239 message = "unknown rule 'test/dataset-is-fast'" ,
240240 rule_id = "test/dataset-is-fast" ,
241- node_path = NODE_ROOT_NAME ,
241+ node_path = DATASET_ROOT_NAME ,
242242 severity = 2 ,
243243 fatal = True ,
244244 )
@@ -294,13 +294,13 @@ def test_linter_real_life_scenario(self):
294294 messages = [
295295 Message (
296296 message = "Attribute name with space: 'created at'" ,
297- node_path = "dataset .attrs['created at']" ,
297+ node_path = f" { DATASET_ROOT_NAME } .attrs['created at']" ,
298298 rule_id = "test/no-space-in-attr-name" ,
299299 severity = 2 ,
300300 ),
301301 Message (
302302 message = "Empty attributes" ,
303- node_path = "dataset .data_vars['tsm'].attrs" ,
303+ node_path = f" { DATASET_ROOT_NAME } .data_vars['tsm'].attrs" ,
304304 rule_id = "test/no-empty-attrs" ,
305305 severity = 1 ,
306306 ),
@@ -310,7 +310,7 @@ def test_linter_real_life_scenario(self):
310310 "variable 'chl' is missing a "
311311 "coordinate variable"
312312 ),
313- node_path = "dataset .data_vars['chl']" ,
313+ node_path = f" { DATASET_ROOT_NAME } .data_vars['chl']" ,
314314 rule_id = "test/data-var-dim-must-have-coord" ,
315315 severity = 2 ,
316316 ),
@@ -320,7 +320,7 @@ def test_linter_real_life_scenario(self):
320320 "variable 'tsm' is missing a "
321321 "coordinate variable"
322322 ),
323- node_path = "dataset .data_vars['tsm']" ,
323+ node_path = f" { DATASET_ROOT_NAME } .data_vars['tsm']" ,
324324 rule_id = "test/data-var-dim-must-have-coord" ,
325325 severity = 2 ,
326326 ),
@@ -342,13 +342,13 @@ def test_processor_ok(self):
342342 [
343343 Message (
344344 message = "Dataset does not have data variables" ,
345- node_path = "dataset [0]" ,
345+ node_path = f" { DATASET_ROOT_NAME } [0]" ,
346346 rule_id = "test/dataset-without-data-vars" ,
347347 severity = 1 ,
348348 ),
349349 Message (
350350 message = "Dataset does not have data variables" ,
351- node_path = "dataset [1]" ,
351+ node_path = f" { DATASET_ROOT_NAME } [1]" ,
352352 rule_id = "test/dataset-without-data-vars" ,
353353 severity = 1 ,
354354 ),
@@ -371,7 +371,7 @@ def test_processor_fail(self):
371371 message = "bad checksum" ,
372372 severity = 2 ,
373373 fatal = True ,
374- node_path = NODE_ROOT_NAME ,
374+ node_path = DATASET_ROOT_NAME ,
375375 )
376376 ],
377377 result .messages ,
0 commit comments