newcleo-dev-team / dassh_nc

Ducted Assembly Steady State Heat Transfer Software (DASSH)
Other
0 stars 0 forks source link

Improve coverage of tests about Material class #2

Open fpepe-polito opened 5 days ago

fpepe-polito commented 5 days ago

The current suite of tests for the class Material(), included in the file _testmaterial.py, covers only some of the possible class capabilities.

In addition to these considerations, the structure of the material test file can be re-organized and improved by defining a single test class, and by automatizing the generation and management of expected properties data (ex. in test_lead() etc.), and of coefficients to be used in test_material_from_coeff(), avoiding hard-coded values.

Property interpolation is performed by means of the numpy.interp() function, which is intended for strictly increasing monotonic values of temperature, but does not raise an error in case this does not happen. A check on the strict monotonicity of the temperature values in tables should be added in the source code, in the material.py file. Then, two new tests should be added, to check that an error is raised in case of two equal temperatures and of non-increasing values.

If values of properties are negative, missing, or zero, they are skipped and interpolation is done using the adjacent values: a warning is additionally written only in case of negative values. The missing and zero value cases are tested in test_table_with_missing_values(). We would prefer to avoid making assumptions on negative or zero values of the properties, thus changing this behavior by raising an error.

fpepe-polito commented 2 days ago

Changes related to the source code such as checking on the strict monotonicity of temperatures in tables and the management of negative, zero or missing values will be addressed in issue #4.