Skip to content

Commit

Permalink
Remove parsing tests that exist in test_selector.py
Browse files Browse the repository at this point in the history
We had some tests in `test_selector.py::GraphTest` that didn't add
anything ontop of what was already being tested else where in the file
except the parsing of models. However, the tests in `test_parser.py::ModelParserTest`
cover everything being tested here (and then some). Thus these tests
in `test_selector.py::GraphTest` are unnecessary and can be deleted.
  • Loading branch information
QMalcolm committed Jun 7, 2024
1 parent c17ea3f commit 03fb727
Showing 1 changed file with 0 additions and 94 deletions.
94 changes: 0 additions & 94 deletions tests/unit/graph/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,100 +448,6 @@ def load_manifest(self, config):
loader.load()
return loader.manifest

# TODO move / delete: This is testing ref parsing, not the selector nor compiler
def test__two_models_package_ref(self):
self.use_models(
{
"model_one": "select * from events",
"model_two": "select * from {{ref('test_models_compile', 'model_one')}}",
}
)

config = self.get_config()
manifest = self.load_manifest(config)
compiler = self.get_compiler(config)
linker = compiler.compile(manifest)

self.assertCountEqual(
linker.nodes(),
[
"model.test_models_compile.model_one",
"model.test_models_compile.model_two",
],
)

self.assertCountEqual(
linker.edges(),
[
(
"model.test_models_compile.model_one",
"model.test_models_compile.model_two",
)
],
)

# TODO move / delete: This is testing materialization configuration, not the selector nor compiler
def test__model_materializations(self):
self.use_models(
{
"model_one": "select * from events",
"model_two": "select * from {{ref('model_one')}}",
"model_three": "select * from events",
"model_four": "select * from events",
}
)

cfg = {
"models": {
"materialized": "table",
"test_models_compile": {
"model_one": {"materialized": "table"},
"model_two": {"materialized": "view"},
"model_three": {"materialized": "ephemeral"},
},
}
}

config = self.get_config(cfg)
manifest = self.load_manifest(config)

expected_materialization = {
"model_one": "table",
"model_two": "view",
"model_three": "ephemeral",
"model_four": "table",
}

for model, expected in expected_materialization.items():
key = "model.test_models_compile.{}".format(model)
actual = manifest.nodes[key].config.materialized
self.assertEqual(actual, expected)

# TODO move / delete: This is testing materialization configuration, not the selector nor compiler
# The "compiler" testing that is going on here is no different from test_single_model
def test__model_incremental(self):
self.use_models({"model_one": "select * from events"})

cfg = {
"models": {
"test_models_compile": {
"model_one": {"materialized": "incremental", "unique_key": "id"},
}
}
}

config = self.get_config(cfg)
manifest = self.load_manifest(config)
compiler = self.get_compiler(config)
linker = compiler.compile(manifest)

node = "model.test_models_compile.model_one"

self.assertEqual(list(linker.nodes()), [node])
self.assertEqual(list(linker.edges()), [])

self.assertEqual(manifest.nodes[node].config.materialized, "incremental")

# TODO move / delete: This is testing partial parsing, not the selector nor compiler
def test__partial_parse(self):
config = self.get_config()
Expand Down

0 comments on commit 03fb727

Please sign in to comment.