diff --git a/airflow/models/param.py b/airflow/models/param.py index fcbe7a0f931c6..1179dd9fd6d0c 100644 --- a/airflow/models/param.py +++ b/airflow/models/param.py @@ -147,6 +147,9 @@ def __delitem__(self, v: str) -> None: def __iter__(self): return iter(self.__dict) + def __repr__(self): + return repr(self.dump()) + def __setitem__(self, key: str, value: Any) -> None: """ Override for dictionary's ``setitem`` method. This method make sure that all values are of diff --git a/tests/models/test_param.py b/tests/models/test_param.py index 3529f0360cdcf..bbd430d773609 100644 --- a/tests/models/test_param.py +++ b/tests/models/test_param.py @@ -193,6 +193,10 @@ def test_update(self): with pytest.raises(ParamValidationError, match=r'Invalid input for param key: 1 is not'): pd.update({'key': 1}) + def test_repr(self): + pd = ParamsDict({'key': Param('value', type='string')}) + assert repr(pd) == "{'key': 'value'}" + class TestDagParamRuntime: VALUE = 42