88from proselint .command_line import get_parser , proselint
99from proselint .config import (
1010 DEFAULT ,
11- _deepmerge_dicts , # pyright: ignore[reportUnknownVariableType, reportPrivateUsage]
11+ _deepmerge_dicts , # pyright: ignore[reportPrivateUsage]
1212 load_from ,
1313)
14+ from proselint .registry import CheckRegistry
1415
1516CONFIG_FILE = Path (__file__ ).parent / "test-proselintrc.json"
1617PARSER = get_parser ()
@@ -29,6 +30,44 @@ def test_deepmerge_dicts() -> None:
2930 }
3031
3132
33+ def test_specific_overrides_general () -> None :
34+ """Test that specific config keys override general ones."""
35+ checks = {
36+ "typography" : True ,
37+ "typography.symbols" : False ,
38+ "typography.symbols.curly_quotes" : True ,
39+ "typography.punctuation.hyperbole" : False ,
40+ }
41+
42+ registry = CheckRegistry ()
43+ enabled = registry .get_all_enabled (checks )
44+
45+ paths = {check .path for check in enabled }
46+
47+ assert any (
48+ "typography.symbols.curly_quotes" in path
49+ for path in paths
50+ )
51+
52+ assert len (
53+ [path for path in paths
54+ if path .startswith ("typography.symbols." )
55+ and "curly_quotes" not in path ]
56+ ) == 0
57+
58+ assert not any (
59+ "typography.punctuation.hyperbole" in path
60+ for path in paths
61+ )
62+
63+ assert any (
64+ path .startswith ("typography." )
65+ and not path .startswith ("typography.symbols." )
66+ and "hyperbole" not in path
67+ for path in paths
68+ )
69+
70+
3271def test_load_from () -> None :
3372 """Test load_options by specifying a user options path."""
3473 overrides = load_from (CONFIG_FILE )
0 commit comments