99from sqlmesh import Context
1010from sqlmesh.core.model import TimeColumn, IncrementalByTimeRangeKind
1111from sqlmesh.core.model.kind import OnDestructiveChange, OnAdditiveChange
12+ from sqlmesh.core.state_sync.db.snapshot import _snapshot_to_json
1213from sqlmesh.dbt.common import Dependencies
1314from sqlmesh.dbt.context import DbtContext
1415from sqlmesh.dbt.model import ModelConfig
@@ -328,7 +329,8 @@ def test_load_incremental_time_range_strategy_required_only(
328329
329330 snapshot_fqn = '"local"."main"."incremental_time_range"'
330331 context = Context(paths=project_dir)
331- model = context.snapshots[snapshot_fqn].model
332+ snapshot = context.snapshots[snapshot_fqn]
333+ model = snapshot.model
332334 # Validate model-level attributes
333335 assert model.start == "2025-01-01"
334336 assert model.interval_unit.is_day
@@ -342,6 +344,8 @@ def test_load_incremental_time_range_strategy_required_only(
342344 assert model.depends_on_self is False
343345 assert model.kind.auto_restatement_intervals is None
344346 assert model.kind.partition_by_time_column is True
347+ # make sure the snapshot can be serialized to json
348+ assert isinstance(_snapshot_to_json(snapshot), str)
345349
346350
347351@pytest.mark.slow
@@ -381,7 +385,8 @@ def test_load_incremental_time_range_strategy_all_defined(
381385
382386 snapshot_fqn = '"local"."main"."incremental_time_range"'
383387 context = Context(paths=project_dir)
384- model = context.snapshots[snapshot_fqn].model
388+ snapshot = context.snapshots[snapshot_fqn]
389+ model = snapshot.model
385390 # Validate model-level attributes
386391 assert model.start == "2025-01-01"
387392 assert model.interval_unit.is_day
@@ -402,6 +407,8 @@ def test_load_incremental_time_range_strategy_all_defined(
402407 assert model.kind.batch_size == 3
403408 assert model.kind.batch_concurrency == 2
404409 assert model.depends_on_self is False
410+ # make sure the snapshot can be serialized to json
411+ assert isinstance(_snapshot_to_json(snapshot), str)
405412
406413
407414@pytest.mark.slow
0 commit comments