Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: make exp_show return float instead of None for zeroes #10034

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dvc/api/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/func/api/test_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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