muditagrawal2007 commented on PR #74920:
URL: https://github.com/apache/airflow/pull/74920#issuecomment-6238765642
@abhijeets25012-tech — thank you for catching that gap. The original
`test_template_fields_extra_class_level_merges_into_template_fields` test only
verified the joined set, which left the order-preservation guarantee implicit.
A future change that swapped `dict.fromkeys(...)` for `tuple(...) + tuple(...)`
(or anything else that didn't dedup) would have passed that test.
Just added in commit `29c905f`:
- `test_template_fields_extra_preserves_order_and_deduplicates`
(parametrized four ways: partial overlap, full overlap, reverse-order, empty
extras). The partial-overlap case is the one you described —
`template_fields=("arg1","arg2")` with
`template_fields_extra=frozenset({"arg2","arg3"})` — and it asserts the result
is `["arg1","arg2","arg3"]` (each field once, original `template_fields` order
kept).
-
`test_template_fields_extra_preserves_order_and_deduplicates_through_mapped_operator`
covers the same property through `.partial().expand()`, so a regression in
`DecoratedMappedOperator` (which builds the same merged list, just in a
different module) is also caught.
Both pass under `uv run --project task-sdk pytest
task-sdk/tests/task_sdk/bases/test_operator.py -k template_fields_extra`. The
reverse-order case in particular is the one that would have failed if the merge
were order-sensitive; if you'd prefer that be the headline case or want any of
the others renamed, happy to adjust.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]