api: make exp_show return float instead of None for zeroes

This commit is contained in:
dberenbaum
2023-10-30 13:54:31 -05:00
committed by Dave Berenbaum
parent 89b4beb7a4
commit fc5147767f
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ def _postprocess(exp_rows):
except ValueError:
exp_row[k] = v_str
if not exp_row[k]:
elif not exp_row[k]:
exp_row[k] = None
return exp_rows
+4
View File
@@ -20,6 +20,8 @@ def test_exp_save(tmp_dir, dvc, scm):
def test_exp_show(tmp_dir, dvc, scm, exp_stage): # noqa: F811
with open("params.yaml", "a") as fobj:
fobj.write("\nbar: 0")
exps = api.exp_show()
assert len(exps) == 2
@@ -32,3 +34,5 @@ def test_exp_show(tmp_dir, dvc, scm, exp_stage): # noqa: F811
assert exps[0]["State"] is None
# Postprocessing empty string as `None`
assert exps[0]["Experiment"] is None
# Postprocessing 0 as float
assert exps[0]["bar"] == 0.0