potiuk commented on code in PR #70349:
URL: https://github.com/apache/airflow/pull/70349#discussion_r4676915469
##########
airflow-core/tests/unit/utils/test_helpers.py:
##########
@@ -113,6 +113,14 @@ def test_merge_dicts_recursive_right_only(self):
merged = merge_dicts(dict1, dict2)
assert merged == {"a": 1, "r": {"b": 0, "c": 3}}
+ def test_merge_dicts_overwrites_non_dict_with_dict(self):
+ """
+ When dict1 holds a non-dict for a key and dict2 holds a dict, dict2
overwrites
+ (per the documented contract) instead of recursing into the non-dict
and raising.
+ """
+ assert merge_dicts({"a": 1}, {"a": {"b": 2}}) == {"a": {"b": 2}}
Review Comment:
**Use `@pytest.mark.parametrize` for multiple similar inputs**
> Use `@pytest.mark.parametrize` for multiple similar inputs — consolidate
tests that only differ in input/expected values into a single parametrized test.
Parametrize over the existing non-dict value (`1`, `[1, 2]`, and `None`,
which also crashed before) so each case reports on its own instead of stopping
at the first failing assert.
--
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]