@@ -3582,10 +3582,10 @@ def test_runtime_partition_keys_fan_out_to_one_event_per_key(dag_maker, session)
35823582 assert dr .partition_key is None
35833583
35843584
3585- def test_runtime_partition_key_falls_back_to_dag_run_when_event_has_no_key (dag_maker , session ):
3586- """An outlet event without partition_key falls back to dag_run.partition_key (backward compat) ."""
3585+ def test_runtime_partition_key_is_none_when_event_has_no_key (dag_maker , session ):
3586+ """An outlet event without partition_key produces an AssetEvent with partition_key=None ."""
35873587 asset = Asset (name = "hello" )
3588- with dag_maker (dag_id = "rt_pk_fallback " , schedule = None ) as dag :
3588+ with dag_maker (dag_id = "rt_pk_none " , schedule = None ) as dag :
35893589 EmptyOperator (task_id = "hi" , outlets = [asset ])
35903590 dr = dag_maker .create_dagrun (partition_key = "from-run" , session = session )
35913591 [ti ] = dr .get_task_instances (session = session )
@@ -3599,11 +3599,11 @@ def test_runtime_partition_key_falls_back_to_dag_run_when_event_has_no_key(dag_m
35993599 session = session ,
36003600 )
36013601 event = session .scalar (select (AssetEvent ).where (AssetEvent .source_dag_id == dag .dag_id ))
3602- assert event .partition_key == "from-run"
3602+ assert event .partition_key is None
36033603
36043604
36053605def test_runtime_partition_key_mixed_events_for_same_asset (dag_maker , session ):
3606- """One event with partition_key + one without produce two AssetEvents (with/without override )."""
3606+ """One event with partition_key + one without produce two AssetEvents (key + None )."""
36073607 asset = Asset (name = "hello" )
36083608 with dag_maker (dag_id = "rt_pk_mixed" , schedule = None ) as dag :
36093609 EmptyOperator (task_id = "hi" , outlets = [asset ])
@@ -3620,7 +3620,7 @@ def test_runtime_partition_key_mixed_events_for_same_asset(dag_maker, session):
36203620 session = session ,
36213621 )
36223622 events = session .scalars (select (AssetEvent ).where (AssetEvent .source_dag_id == dag .dag_id )).all ()
3623- assert {e .partition_key for e in events } == {"us" , "from-run" }
3623+ assert {e .partition_key for e in events } == {"us" , None }
36243624 session .refresh (dr )
36253625 assert dr .partition_key == "from-run"
36263626
0 commit comments