def test_invalid_findercolor_colorid(temp_file): from osxmetadata import OSXMetaData from osxmetadata.constants import _MAX_FINDER_COLOR, _MIN_FINDER_COLOR meta = OSXMetaData(temp_file) with pytest.raises(ValueError): meta.findercolor = _MAX_FINDER_COLOR + 1 with pytest.raises(ValueError): meta.findercolor = _MIN_FINDER_COLOR - 1
def test_findercolor_colorid(temp_file): from osxmetadata import OSXMetaData, Tag from osxmetadata.constants import _MAX_FINDER_COLOR from osxmetadata.findertags import get_tag_color_name meta = OSXMetaData(temp_file) # check each color combo. Setting 0 doesn't work -- the attribute gets deleted for color_id in range(_MAX_FINDER_COLOR + 1, _MAX_FINDER_COLOR + 1): meta.findercolor = color_id color_got = meta.findercolor assert color_got == color_id color_name = get_tag_color_name(color_id) assert meta.tags == [Tag(color_name, color_id)]