mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* init * rename to plot data insertion basig on dicts update * revision support * roll back revision * plot makedirs for backward compatibility * log path * pretty plot link to visualization page * make target default title * efiop review * efiop review * plot multiple initial * add some missing metric file tests * proper id generation * proper id generation * add confusion matrix template * refactor tests * plot from dvct file * plot from dvct * brush up commands * fix confusion matrix multiple plot * plot: change confusion matrix data schema * should be working as intended * support for src file in dvct files * minor fixes * plot: support json templates * plot: rename confusion template * plot: polish command behaviour * fix test for json * plot: test command * some minor fixes for tests * plot: unit test loading * plot: unit test loading * plot: handle TODOS * cleanup * use mocker * plot: support tsv * plot: command refactoring * plot: fix windows issues with tests * plot: test: some more windows fixes * plot: _load_from_revisions complexity fix * plot: reduce complexity * plot: complexity reduction * plot: deepsource suggestions * plot: move template path evaluation * fixup * fixup * exception on no datafile and no template * json metric load with OrderedDict * plot: improve handling non-existing files on revisions * plot: improve handling non-existing files on revisions * change default plot path * some exceptions and fixes * add yaml metrics support * fixup * some more suggestions * default filename fix * efiop review requests * log exception on failur * move revisions deduction to commands * json templates * extract template filling to separate method * some parsing improvements * add columns functionality * extract default data transformation to separate method * plot: initial support for jsonpath * plot: rename columns to filters, tests are dict based * plot: fixups * plot: refactoring * repo: plot: convert to package * plot: data loading refactor, support searching for data * plot: raise if wrong fields provided * plot: command description * plot: default: pass y axis info for default plot * plot: get rid of fieldnames, expect ordered data * plot: handle default plot in separate method * plot: fix default * plot: command option names fixes * refactoring * fixes * plot: provide option for stdout redirection * plot: rename show-json to no-html * plot: add no-csv-header option * plot: improve error message for wrongly structured metric * plot: match template name exactly, whit suffix appended only * plot: dmpetrov and ivan review * plot: refactor --stdout help message * plot: move template to repo/plot * plot: add -x and -y options * plot: add -x and -y options * plot: command: order change * plot: scatter * plot: rename confusion matrix template, new name generation format * plot: add title anchor * plot: review from jorgeorpinel * plot: rename filter and result options to select and file * plot: add --title, --x-title, --y-title * plot: xlab ylab * Update dvc/repo/plot/template.py Co-authored-by: Ruslan Kuprieiev <[email protected]> * Update dvc/repo/plot/template.py Co-authored-by: Ruslan Kuprieiev <[email protected]> * efiop review * plot: bash completion * plot: static code analysis fixes Co-authored-by: Ruslan Kuprieiev <[email protected]>
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
import pytest
|
|
|
|
from dvc.repo.plot.data import _apply_path, _lists, _find_data
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"path,expected_result",
|
|
[
|
|
("$.some.path[*].a", [{"a": 1}, {"a": 4}]),
|
|
("$.some.path", [{"a": 1, "b": 2, "c": 3}, {"a": 4, "b": 5, "c": 6}]),
|
|
],
|
|
)
|
|
def test_parse_json(path, expected_result):
|
|
value = {
|
|
"some": {"path": [{"a": 1, "b": 2, "c": 3}, {"a": 4, "b": 5, "c": 6}]}
|
|
}
|
|
|
|
result = _apply_path(value, path=path)
|
|
|
|
assert result == expected_result
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"dictionary, expected_result",
|
|
[
|
|
({}, []),
|
|
({"x": ["a", "b", "c"]}, [["a", "b", "c"]]),
|
|
(
|
|
{"x": {"y": ["a", "b"]}, "z": {"w": ["c", "d"]}},
|
|
[["a", "b"], ["c", "d"]],
|
|
),
|
|
],
|
|
)
|
|
def test_finding_lists(dictionary, expected_result):
|
|
result = _lists(dictionary)
|
|
|
|
assert list(result) == expected_result
|
|
|
|
|
|
@pytest.mark.parametrize("fields", [{"x"}, set()])
|
|
def test_finding_data(fields):
|
|
data = {"a": {"b": [{"x": 2, "y": 3}, {"x": 1, "y": 5}]}}
|
|
|
|
result = _find_data(data, fields=fields)
|
|
|
|
assert result == [{"x": 2, "y": 3}, {"x": 1, "y": 5}]
|