mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
* plots: support images initial * plots: data: unify PlotsData * plots: data conversion refactor * plots: renderers: abstract functionality * plots: uncommenting tests * plots: self implement grouping * plots: rename group * plots: extract rendering tests * plots: move rendering tests to unit * plots: add image rendering tests * plots: dont use dpath to find vega plot * plots: test find_vega * plots: test render function * plots: move rendering out of repo package * plots: refactoring * plots: self review refactor
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
from tests.func.plots.utils import _write_json
|
|
|
|
|
|
def test_diff_dirty(tmp_dir, scm, dvc, run_copy_metrics):
|
|
_write_json(tmp_dir, [{"y": 2}, {"y": 3}], "metric_t.json")
|
|
run_copy_metrics(
|
|
"metric_t.json",
|
|
"metric.json",
|
|
plots_no_cache=["metric.json"],
|
|
commit="init",
|
|
)
|
|
|
|
metric_head = [{"y": 3}, {"y": 5}]
|
|
_write_json(tmp_dir, metric_head, "metric_t.json")
|
|
run_copy_metrics(
|
|
"metric_t.json",
|
|
"metric.json",
|
|
plots_no_cache=["metric.json"],
|
|
commit="second",
|
|
)
|
|
|
|
metric_1 = [{"y": 5}, {"y": 6}]
|
|
_write_json(tmp_dir, metric_1, "metric_t.json")
|
|
run_copy_metrics(
|
|
"metric_t.json", "metric.json", plots_no_cache=["metric.json"]
|
|
)
|
|
props = {"fields": {"y"}}
|
|
diff_result = dvc.plots.diff(props=props)
|
|
assert diff_result == {
|
|
"workspace": {
|
|
"data": {"metric.json": {"data": metric_1, "props": props}}
|
|
},
|
|
"HEAD": {
|
|
"data": {"metric.json": {"data": metric_head, "props": props}}
|
|
},
|
|
}
|
|
metric_2 = [{"y": 7}, {"y": 8}]
|
|
_write_json(tmp_dir, metric_2, "metric.json")
|
|
|
|
diff_result = dvc.plots.diff(props=props)
|
|
assert diff_result == {
|
|
"workspace": {
|
|
"data": {"metric.json": {"data": metric_2, "props": props}}
|
|
},
|
|
"HEAD": {
|
|
"data": {"metric.json": {"data": metric_head, "props": props}}
|
|
},
|
|
}
|