@@ -112,7 +112,7 @@ def test_get_version_from_dependency_success():
112112
113113 with (
114114 patch ("pathlib.Path.exists" , return_value = True ),
115- patch ("toml .load" , return_value = mock_toml_content ),
115+ patch ("cpp_linter_hooks.util.tomllib .load" , return_value = mock_toml_content ),
116116 ):
117117 result = get_version_from_dependency ("clang-format" )
118118 assert result == "20.1.7"
@@ -136,7 +136,7 @@ def test_get_version_from_dependency_missing_dependency():
136136
137137 with (
138138 patch ("pathlib.Path.exists" , return_value = True ),
139- patch ("toml .load" , return_value = mock_toml_content ),
139+ patch ("cpp_linter_hooks.util.tomllib .load" , return_value = mock_toml_content ),
140140 ):
141141 result = get_version_from_dependency ("clang-format" )
142142 assert result is None
@@ -149,7 +149,7 @@ def test_get_version_from_dependency_malformed_toml():
149149
150150 with (
151151 patch ("pathlib.Path.exists" , return_value = True ),
152- patch ("toml .load" , return_value = mock_toml_content ),
152+ patch ("cpp_linter_hooks.util.tomllib .load" , return_value = mock_toml_content ),
153153 ):
154154 result = get_version_from_dependency ("clang-format" )
155155 assert result is None
@@ -161,11 +161,11 @@ def test_get_version_from_dependency_malformed_toml():
161161 "user_input,expected" ,
162162 [
163163 (None , None ),
164- ("20" , "20.1.7 " ), # Should find latest 20.x
165- ("20.1" , "20.1.7 " ), # Should find latest 20.1.x
164+ ("20" , "20.1.0 " ), # Should find first 20.x
165+ ("20.1" , "20.1.0 " ), # Should find first 20.1.x
166166 ("20.1.7" , "20.1.7" ), # Exact match
167- ("18" , "18.1.8 " ), # Should find latest 18.x
168- ("18.1" , "18.1.8 " ), # Should find latest 18.1.x
167+ ("18" , "18.1.0 " ), # Should find first 18.x
168+ ("18.1" , "18.1.0 " ), # Should find first 18.1.x
169169 ("99" , None ), # Non-existent major version
170170 ("20.99" , None ), # Non-existent minor version
171171 ("invalid" , None ), # Invalid version string
@@ -182,9 +182,9 @@ def test_resolve_version_clang_format(user_input, expected):
182182 "user_input,expected" ,
183183 [
184184 (None , None ),
185- ("20" , "20.1.0" ), # Should find latest 20.x
186- ("18" , "18.1.8 " ), # Should find latest 18.x
187- ("19" , "19.1.0.1 " ), # Should find latest 19.x
185+ ("20" , "20.1.0" ), # Should find first 20.x
186+ ("18" , "18.1.1 " ), # Should find first 18.x
187+ ("19" , "19.1.0" ), # Should find first 19.x
188188 ("99" , None ), # Non-existent major version
189189 ],
190190)
0 commit comments