Skip to content

Commit

Permalink
unit test format_batch_start
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Sep 22, 2024
1 parent cdb0bcb commit efe3a1d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/graph/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Measure,
TestMetadata,
)
from dbt.artifacts.resources.types import BatchSize
from dbt.artifacts.resources.v1.semantic_model import NodeRelation
from dbt.contracts.graph.model_config import TestConfig
from dbt.contracts.graph.nodes import ColumnInfo, ModelNode, ParsedNode, SemanticModel
Expand Down Expand Up @@ -110,6 +111,22 @@ def test_all_constraints(

assert default_model_node.all_constraints == expected_all_constraints

@pytest.mark.parametrize(
"batch_size,batch_start,expected_formatted_batch_start",
[
(None, None, None),
(BatchSize.year, datetime(2020, 1, 1, 1), "2020-01-01"),
(BatchSize.month, datetime(2020, 1, 1, 1), "2020-01-01"),
(BatchSize.day, datetime(2020, 1, 1, 1), "2020-01-01"),
(BatchSize.hour, datetime(2020, 1, 1, 1), "2020-01-01 01:00:00"),
],
)
def test_format_batch_start(
self, default_model_node, batch_size, batch_start, expected_formatted_batch_start
):
default_model_node.config.batch_size = batch_size
assert default_model_node.format_batch_start(batch_start) == expected_formatted_batch_start


class TestSemanticModel:
@pytest.fixture(scope="function")
Expand Down

0 comments on commit efe3a1d

Please sign in to comment.