xarray-contrib/xarray-simlab

Issue with non-decorated classes inheriting from process-decorated classes

benbovy opened this issue · 0 comments

That's an edge case with a surprising effect: if we create a new class that inherits from an existing process class, but we forget to decorate it with xs.process, it is actually the latter (i.e., the parent class) that is used when the former (i.e., the child class) is included in a Model. No error is raised when creating the Model object, so it was hard to figure it out.

We must ensure that the function below raises an error when cls is not itself process-decorated. The try... except block in that function is not enough.

https://github.com/benbovy/xarray-simlab/blob/45359e99cbf6341464b02cb937618c051a58a31c/xsimlab/process.py#L24