aiidateam / plumpy

A python workflows library that supports writing Processes with a well defined set of inputs and outputs that can be strung together.
https://plumpy.readthedocs.io
Other
8 stars 17 forks source link

`PortNamespace`: Fix bug in valid type checking of dynamic namespaces #255

Closed sphuber closed 1 year ago

sphuber commented 1 year ago

If a valid_type is set on a PortNamespace it is automatically made dynamic. If a namespace is dynamic, it means that it should accept any nested namespace, however deeply nested. However, the leafs of the inputs should still respect the valid_type. This was not the case though. As soon as a port namespace was made dynamic, any nested input namespace would be expected, regardless of the types of the leaf values.

The PortNamespace.validate_dynamic_ports is made recursive. If a port value is a dictionary, it recursively calls itself to validate its nested values, ultimately making sure that leaf values have a valid type if one is specified for the namespace.

codecov[bot] commented 1 year ago

Codecov Report

Base: 90.73% // Head: 90.74% // Increases project coverage by +0.01% :tada:

Coverage data is based on head (caf0bce) compared to base (ed1b6cb). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## support/0.21.x #255 +/- ## ================================================== + Coverage 90.73% 90.74% +0.01% ================================================== Files 21 21 Lines 2964 2967 +3 ================================================== + Hits 2689 2692 +3 Misses 275 275 ``` | [Impacted Files](https://codecov.io/gh/aiidateam/plumpy/pull/255?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | Coverage Δ | | |---|---|---| | [src/plumpy/ports.py](https://codecov.io/gh/aiidateam/plumpy/pull/255/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam#diff-c3JjL3BsdW1weS9wb3J0cy5weQ==) | `93.38% <100.00%> (+0.07%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.