tests: changing tests to reverted diff functionality

This commit is contained in:
paulourbano
2023-05-05 22:25:38 +02:00
committed by David de la Iglesia Castro
parent 31b0b8de73
commit 75952c4e36
2 changed files with 16 additions and 18 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ def test_metrics_diff_yaml(tmp_dir, scm, dvc, run_copy_metrics):
expected = {
"m.yaml": {
"a.b.e": {"old": "1", "new": "3", "diff": ""},
"a.b.e": {"old": "1", "new": "3"},
"a.b.c": {"old": 1, "new": 3, "diff": 2},
}
}
@@ -54,7 +54,7 @@ def test_metrics_diff_json(tmp_dir, scm, dvc, run_copy_metrics):
expected = {
"m.json": {
"a.b.e": {"old": "1", "new": "3", "diff": ""},
"a.b.e": {"old": "1", "new": "3"},
"a.b.c": {"old": 1, "new": 3, "diff": 2},
}
}
+14 -16
View File
@@ -27,7 +27,7 @@ def test_diff(tmp_dir, scm, dvc):
tmp_dir.scm_gen("params.yaml", "foo: qux", commit="qux")
assert dvc.params.diff(a_rev="HEAD~2") == {
"params.yaml": {"foo": {"old": "bar", "new": "qux", "diff": ""}}
"params.yaml": {"foo": {"old": "bar", "new": "qux"}}
}
@@ -40,9 +40,7 @@ def test_diff_dirty(tmp_dir, scm, dvc):
tmp_dir.scm_gen("params.yaml", "foo: baz", commit="baz")
tmp_dir.gen("params.yaml", "foo: qux")
assert dvc.params.diff() == {
"params.yaml": {"foo": {"old": "baz", "new": "qux", "diff": ""}}
}
assert dvc.params.diff() == {"params.yaml": {"foo": {"old": "baz", "new": "qux"}}}
def test_diff_new(tmp_dir, scm, dvc):
@@ -73,7 +71,7 @@ def test_diff_list(tmp_dir, scm, dvc):
assert dvc.params.diff() == {
"params.yaml": {
"foo": {"old": "['bar', 'baz']", "new": "['bar', 'baz', 'qux']", "diff": ""}
"foo": {"old": "['bar', 'baz']", "new": "['bar', 'baz', 'qux']"}
}
}
@@ -87,7 +85,7 @@ def test_diff_dict(tmp_dir, scm, dvc):
tmp_dir.gen("params.yaml", "foo:\n bar: qux")
assert dvc.params.diff() == {
"params.yaml": {"foo.bar": {"old": "baz", "new": "qux", "diff": ""}}
"params.yaml": {"foo.bar": {"old": "baz", "new": "qux"}}
}
@@ -102,8 +100,8 @@ def test_diff_with_unchanged(tmp_dir, scm, dvc):
assert dvc.params.diff(a_rev="HEAD~2", all=True) == {
"params.yaml": {
"xyz": {"old": "val", "new": "val", "diff": ""},
"foo": {"old": "bar", "new": "qux", "diff": ""},
"foo": {"old": "bar", "new": "qux"},
"xyz": {"old": "val", "new": "val"},
}
}
@@ -121,7 +119,7 @@ def test_pipeline_tracked_params(tmp_dir, scm, dvc, run_copy):
tmp_dir.scm_gen("params.yaml", "foo: qux\nxyz: val", commit="qux")
assert dvc.params.diff(a_rev="HEAD~2") == {
"params.yaml": {"foo": {"old": "bar", "new": "qux", "diff": ""}}
"params.yaml": {"foo": {"old": "bar", "new": "qux"}}
}
@@ -204,16 +202,16 @@ def test_diff_targeted(tmp_dir, scm, dvc, run_copy):
)
assert dvc.params.diff(a_rev="HEAD~2") == {
"params.yaml": {"foo": {"old": "bar", "new": "qux", "diff": ""}},
"other_params.yaml": {"xyz": {"old": "val", "new": "val3", "diff": ""}},
"params.yaml": {"foo": {"old": "bar", "new": "qux"}},
"other_params.yaml": {"xyz": {"old": "val", "new": "val3"}},
}
assert dvc.params.diff(a_rev="HEAD~2", targets=["params.yaml"]) == {
"params.yaml": {"foo": {"old": "bar", "new": "qux", "diff": ""}}
"params.yaml": {"foo": {"old": "bar", "new": "qux"}}
}
assert dvc.params.diff(a_rev="HEAD~2", targets=["other_params.yaml"]) == {
"other_params.yaml": {"xyz": {"old": "val", "new": "val3", "diff": ""}}
"other_params.yaml": {"xyz": {"old": "val", "new": "val3"}}
}
@@ -231,9 +229,9 @@ def test_diff_without_targets_specified(tmp_dir, dvc, scm, file):
params_file.dump({"foo": {"bar": "baz"}, "y": "100"})
assert dvc.params.diff() == {
file: {
"y": {"old": None, "new": "100"},
"x": {"old": "0", "new": None},
"foo.bar": {"old": "bar", "new": "baz", "diff": ""},
"foo.bar": {"new": "baz", "old": "bar"},
"x": {"new": None, "old": "0"},
"y": {"new": "100", "old": None},
}
}