ansys / pyensight

Python API for EnSight
http://ensight.docs.pyansys.com
MIT License
6 stars 2 forks source link

fix check on values returned by get_const_val if these are exactly 0 #371

Closed mariostieriansys closed 4 months ago

mariostieriansys commented 4 months ago

As part of the mypy checks I have to split the values returned by get_const_val in case they are per part values (i.e. the function returns a list)

I have to check each of the values, and specifically, I was doing something like

for v in val: if not v: return None

The issue is that if v is exactly 0 or 0.0, not v will be True. So I changed the check to "if v is None"

Also, I took advantage of the PR to make consistent the behavior when a calculator function cannot be computed, always raising a RunTimeError instead of just returning NOne