When querying the value of an optional property from a variable that is set for the variable (therefore assuming the default function or value) and that has a default value (not a default function, these are mutually exclusive), the code returns None instead of the default value. An example is the active attribute, where the default value is .true..
Steps to Reproduce
I've added doctests for this to scripts/metavar.py in PR https://github.com/NCAR/ccpp-framework/pull/508. If you remove the bug fix in (old code) line 499 / (new code) line 505, the doctests fail (cd scripts && python3 -m doctest metavar.py).
Description
When querying the value of an optional property from a variable that is set for the variable (therefore assuming the default function or value) and that has a default value (not a default function, these are mutually exclusive), the code returns
None
instead of the default value. An example is theactive
attribute, where the default value is.true.
.Steps to Reproduce
I've added doctests for this to
scripts/metavar.py
in PR https://github.com/NCAR/ccpp-framework/pull/508. If you remove the bug fix in (old code) line 499 / (new code) line 505, the doctests fail (cd scripts && python3 -m doctest metavar.py
).Additional Context
n/a
Output
Without the bug fix in line 409 / 505: