Skip to content

Commit 0b43579

Browse files
committed
test that we don't overwrite existing metadata in spec
1 parent cf7f5bb commit 0b43579

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

python_modules/dagster/dagster_tests/asset_defs_tests/test_internal_freshness.py

+13
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ def assert_freshness_policy(spec, expected_fail_window, expected_warn_window=Non
8282
)
8383
assert_freshness_policy(asset_spec, expected_fail_window=timedelta(minutes=60))
8484

85+
# Don't overwrite existing metadata
86+
spec_with_metadata = AssetSpec(key="bar", metadata={"existing": "metadata"})
87+
spec_with_metadata = attach_internal_freshness_policy(
88+
spec_with_metadata,
89+
TimeWindowFreshnessPolicy.from_timedeltas(fail_window=timedelta(minutes=60)),
90+
)
91+
assert spec_with_metadata.metadata.get("existing") == "metadata"
92+
assert_freshness_policy(
93+
spec_with_metadata,
94+
expected_fail_window=timedelta(minutes=60),
95+
expected_warn_window=None,
96+
)
97+
8598

8699
def test_map_asset_specs_attach_internal_freshness_policy() -> None:
87100
"""Can we map attach_internal_freshness_policy over a selection of asset specs?"""

0 commit comments

Comments
 (0)