Fix incorrect __round__ behaviour

In some cases with large scenario parameters,
__round__ raises an error:

TypeError: type NoneType doesn't define __round__ method

Fix __round__ behaviour for StreamingAlgorithm ins == None.

Change-Id: I33acb494ddabc6855bd73868ebf8cbeee43bab86
This commit is contained in:
prazumovsky 2020-01-15 17:10:07 +04:00
parent 21630956e4
commit 53241478c8
1 changed files with 5 additions and 1 deletions

View File

@ -330,7 +330,11 @@ class Table(Chart):
:returns: rounded float
:returns: str "n/a"
"""
return round(ins.result(), 3) if has_result else "n/a"
r = ins.result()
if not has_result or r is None:
return "n/a"
else:
return round(r, 3)
def _row_has_results(self, values):
"""Determine whether row can be assumed as having values.