@@ -112,7 +112,7 @@ def test_get_version_from_dependency_success():
112
112
113
113
with (
114
114
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 ),
116
116
):
117
117
result = get_version_from_dependency ("clang-format" )
118
118
assert result == "20.1.7"
@@ -136,7 +136,7 @@ def test_get_version_from_dependency_missing_dependency():
136
136
137
137
with (
138
138
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 ),
140
140
):
141
141
result = get_version_from_dependency ("clang-format" )
142
142
assert result is None
@@ -149,7 +149,7 @@ def test_get_version_from_dependency_malformed_toml():
149
149
150
150
with (
151
151
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 ),
153
153
):
154
154
result = get_version_from_dependency ("clang-format" )
155
155
assert result is None
@@ -161,11 +161,11 @@ def test_get_version_from_dependency_malformed_toml():
161
161
"user_input,expected" ,
162
162
[
163
163
(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
166
166
("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
169
169
("99" , None ), # Non-existent major version
170
170
("20.99" , None ), # Non-existent minor version
171
171
("invalid" , None ), # Invalid version string
@@ -182,9 +182,9 @@ def test_resolve_version_clang_format(user_input, expected):
182
182
"user_input,expected" ,
183
183
[
184
184
(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
188
188
("99" , None ), # Non-existent major version
189
189
],
190
190
)
0 commit comments