mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 15:28:27 +01:00
metrics: diff: fix float precision formatting (#3609)
Texttable will try to detect the column type automatically, which results in a low precision of the float that it is showing. We need to disable that auto-formatting and just use `str(val)` instead.
This commit is contained in:
@@ -121,6 +121,9 @@ def _show_diff(diff):
|
||||
|
||||
table = Texttable()
|
||||
|
||||
# disable automatic formatting
|
||||
table.set_cols_dtype(["t", "t", "t", "t"])
|
||||
|
||||
# remove borders to make it easier for users to copy stuff
|
||||
table.set_chars(("", "", "", ""))
|
||||
table.set_deco(0)
|
||||
|
||||
@@ -119,3 +119,12 @@ def test_metrics_show(dvc, mocker):
|
||||
all_branches=True,
|
||||
all_commits=True,
|
||||
)
|
||||
|
||||
|
||||
def test_metrics_diff_prec():
|
||||
assert _show_diff(
|
||||
{"other.json": {"a.b": {"old": 0.0042, "new": 0.0043, "diff": 0.0001}}}
|
||||
) == (
|
||||
" Path Metric Value Change\n"
|
||||
"other.json a.b 0.0043 0.0001"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user