def test_config_set_flag_all() -> None: config = Config() view_keys = frozenset(("name", "hex")) config.get_view_keys = view_keys config.list_view_keys = view_keys config.json_keys = view_keys config.set_flags(all=None) assert config.get_view_keys == view_keys assert config.list_view_keys == view_keys assert config.json_keys == view_keys config.set_flags(all=False) assert config.get_view_keys == view_keys assert config.list_view_keys == view_keys assert config.json_keys == view_keys config.set_flags(all=True) assert config.get_view_keys == VIEW_KEYS assert config.list_view_keys == VIEW_KEYS assert config.json_keys == JSON_KEYS
from colorpedia.formatters import ( format_cmyk, format_get_view, format_hex, format_hsl, format_hsv, format_list_view, format_name, format_rgb, ) default_config = Config() custom_config = Config() custom_config.uppercase_hex_codes = False custom_config.get_view_keys = frozenset(("name", "hex")) custom_config.list_view_keys = frozenset(("name", "hex")) custom_config.approx_name_suffix = "*" custom_config.set_flags(units=True) @pytest.mark.parametrize( ("c", "m", "y", "k", "expected"), ( (0.000, 0.010, 0.020, 0.030, "C:0 M:1 Y:2 K:3 "), (0.104, 0.204, 0.304, 0.404, "C:10 M:20 Y:30 K:40 "), (0.106, 0.206, 0.306, 0.406, "C:11 M:21 Y:31 K:41 "), (1.000, 1.000, 1.000, 1.000, "C:100 M:100 Y:100 K:100"), ), ) def test_format_cmyk(c, m, y, k, expected):