@@ -435,20 +435,17 @@ def _reindex_tests(self) -> None:
435435 """Index tests based on their associated evaluable."""
436436 for node_values in self .raw_nodes .values ():
437437 if node_values .get ("resource_type" ) == "test" :
438- # tests for models have a non-null value for `attached_node`
438+ # Tests for models have a non-null value for `attached_node`
439439 if attached_node := node_values .get ("attached_node" ):
440440 self .tests [attached_node ].append (node_values )
441441
442- # Tests for sources will have a null `attached_node`,
443- # and a non-empty list for `sources`.
444- # They need to be attributed to the source id
442+ # Tests for sources or separate tests will have `attached_node` == null.
443+ # They need to be attributed to the node id
445444 # based on the `depends_on` field.
446- elif node_values .get ("sources" ) and (
447- source_unique_id := next (
448- iter (node_values .get ("depends_on" , {}).get ("nodes" , [])), None
449- )
445+ elif node_unique_id := next (
446+ iter (node_values .get ("depends_on" , {}).get ("nodes" , [])), None
450447 ):
451- self .tests [source_unique_id ].append (node_values )
448+ self .tests [node_unique_id ].append (node_values )
452449
453450 def _filter_evaluables (self , select : Iterable [str ]) -> None :
454451 """Filter evaluables like dbt's --select."""
0 commit comments