Files
dvc/tests/unit/output/test_annotations.py
T
Saugat Pachhai (सौगात) c73764156e metadata: support custom metadata in .dvc files
This adds support for custom metadata in outputs under `meta` key.
Also adds `--meta` flag to `add`/`import`/`import-url` that supports
`key=value` values.
2022-09-08 14:10:35 +03:00

30 lines
699 B
Python

import pytest
from dvc.annotations import Annotation
@pytest.mark.parametrize(
"kwargs",
[
{"desc": "desc", "type": "type", "labels": ["label1", "label2"]},
{"desc": "desc", "type": "type", "meta": {"key": "value"}},
],
)
def test_annotation_to_dict(kwargs):
annot = Annotation(**kwargs)
assert annot.to_dict() == kwargs
def test_annotation_update():
annot = Annotation(desc="desc", labels=["label1", "label2"])
annot.update(
labels=["label"], type="type", new="new", meta={"key": "value"}
)
assert vars(annot) == {
"desc": "desc",
"type": "type",
"labels": ["label"],
"meta": {"key": "value"},
}