Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Aug 16, 2024
1 parent 1dd26e7 commit 5664422
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/graph/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,25 @@ def test_dependency_list(self, runtime_config: RuntimeConfig):
queue.get(block=False)
queue.mark_done(got.unique_id)
assert queue.empty()

def test_select_downstream_of_empty_model(self, runtime_config: RuntimeConfig):
# empty model
model_one = make_model(pkg="other", name="model_one", code="")
# non-empty model
model_two = make_model(
pkg="pkg",
name="model_two",
code="""select * from {{ref('model_one')}}""",
refs=[model_one],
)
models = [model_one, model_two]
manifest = make_manifest(nodes=models)

# Get the graph
compiler = dbt.compilation.Compiler(runtime_config)
graph = compiler.compile(manifest)

# Ensure that model_two is selected as downstream of model_one
selector = NodeSelector(graph, manifest)
spec = graph_selector.SelectionCriteria.from_single_spec("model_one+")
assert selector.get_selected(spec) == {"model.pkg.model_two"}

0 comments on commit 5664422

Please sign in to comment.