test_input_tag.py
1 from mlflow.entities import InputTag 2 3 4 def _check(input_tag, key, value): 5 assert isinstance(input_tag, InputTag) 6 assert input_tag.key == key 7 assert input_tag.value == value 8 9 10 def test_creation_and_hydration(): 11 key = "my_key" 12 value = "my_value" 13 input_tag = InputTag(key, value) 14 _check(input_tag, key, value) 15 16 as_dict = { 17 "key": key, 18 "value": value, 19 } 20 assert dict(input_tag) == as_dict 21 22 proto = input_tag.to_proto() 23 input_tag2 = InputTag.from_proto(proto) 24 _check(input_tag2, key, value) 25 26 input_tag3 = InputTag.from_dictionary(as_dict) 27 _check(input_tag3, key, value)