tardis-sn / tardis

TARDIS - Temperature And Radiative Diffusion In Supernovae
https://tardis-sn.github.io/tardis
203 stars 405 forks source link

Restructure SDECPlotter to make its methods more atomic, hence unit-testable #1638

Open jaladh-singhal opened 3 years ago

jaladh-singhal commented 3 years ago

Currently, SDECPlotter has two public methods generate_plot_mpl & generate_plot_ply that can be tested. But other methods (that are private and are called by these two) can't be unit-tested because they need to read those attributes of instance that were written by the caller method. And the whole function callstack follows same fashion of reading/writing data from/to instance attributes making each method difficult to test independently - e.g. of one such callstack (top level method calling lower level method):

The class (or whole module if required) should be restructured in a way to make these private methods more atomic in their operations (instead of changing class state too much) so that they can be unit-tested.

roshansingh12 commented 1 year ago

Hi @wkerzendorf if it is not resolved yet, I can work on this. Thank you

andrewfullard commented 1 year ago

Please work on this if you would like.