Files
dvc/tests/unit/output/test_annotations.py
T
skshetry df60df5242 add metadata fields: label, type to data (#8232)
gto like metadata fields: labels and type
2022-09-08 16:33:47 +05:45

23 lines
571 B
Python

import pytest
from dvc.annotations import Annotation
@pytest.mark.parametrize(
"kwargs",
[
{"desc": "desc", "type": "type", "labels": ["label1", "label2"]},
{"desc": "desc", "type": "type"},
],
)
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")
assert vars(annot) == {"desc": "desc", "type": "type", "labels": ["label"]}