Skip to content

Incomplete checks for accidental changes of Node.variable. #186

@tyralla

Description

@tyralla

We try to prevent users from changing (implicitly defined) values of Node.variable:

from hydpy import aliases, FusedVariable, Node

Node("n")

Node("n", variable=FusedVariable("X", aliases.wq_fluxes_Discharge))
Traceback (most recent call last):
...
ValueError: The variable to be represented by a Node instance cannot be changed.  The variable of node `n` is `Q` instead of `X`.  Keep in mind, that `name` is the unique identifier of node objects.

However, the corresponding check does not detect cases like this one:

from hydpy import aliases, FusedVariable, Node

Node("n")

Node("n", variable=FusedVariable("X", aliases.lland_outlets_Q, aliases.wq_fluxes_Discharge))  # no error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions