|
33 | 33 |
|
34 | 34 | class ClarityThresholdsPolicyTest(TestCase): |
35 | 35 | """Test ClarityThresholdsPolicy class functionality.""" |
36 | | - |
| 36 | + |
37 | 37 | data = Path(__file__).parent.parent / "data" |
38 | 38 |
|
39 | 39 | def test_valid_thresholds_initialization(self): |
@@ -152,21 +152,25 @@ def test_yaml_string_invalid_yaml(self): |
152 | 152 | load_thresholds_from_yaml(yaml_content, ClarityThresholdsPolicy) |
153 | 153 |
|
154 | 154 | def test_load_from_existing_file(self): |
155 | | - test_file = self.data / "compliance-thresholds" / "clarity_sample_thresholds.yml" |
| 155 | + test_file = ( |
| 156 | + self.data / "compliance-thresholds" / "clarity_sample_thresholds.yml" |
| 157 | + ) |
156 | 158 | policy = load_thresholds_from_file(test_file, ClarityThresholdsPolicy) |
157 | 159 | self.assertIsNotNone(policy) |
158 | 160 | self.assertEqual(policy.get_alert_for_score(95), "ok") |
159 | 161 | self.assertEqual(policy.get_alert_for_score(75), "warning") |
160 | 162 | self.assertEqual(policy.get_alert_for_score(50), "error") |
161 | 163 |
|
162 | 164 | def test_load_from_nonexistent_file(self): |
163 | | - policy = load_thresholds_from_file("/nonexistent/file.yml", ClarityThresholdsPolicy) |
| 165 | + policy = load_thresholds_from_file( |
| 166 | + "/nonexistent/file.yml", ClarityThresholdsPolicy |
| 167 | + ) |
164 | 168 | self.assertIsNone(policy) |
165 | 169 |
|
166 | 170 |
|
167 | 171 | class ScorecardThresholdsPolicyTest(TestCase): |
168 | 172 | """Test ScorecardThresholdsPolicy class functionality.""" |
169 | | - |
| 173 | + |
170 | 174 | data = Path(__file__).parent.parent / "data" |
171 | 175 |
|
172 | 176 | def test_valid_thresholds_initialization(self): |
@@ -286,14 +290,17 @@ def test_yaml_string_invalid_yaml(self): |
286 | 290 | load_thresholds_from_yaml(yaml_content, ScorecardThresholdsPolicy) |
287 | 291 |
|
288 | 292 | def test_load_from_existing_file(self): |
289 | | - test_file = self.data / "compliance-thresholds" / "scorecard_sample_thresholds.yml" |
| 293 | + test_file = ( |
| 294 | + self.data / "compliance-thresholds" / "scorecard_sample_thresholds.yml" |
| 295 | + ) |
290 | 296 | policy = load_thresholds_from_file(test_file, ScorecardThresholdsPolicy) |
291 | 297 | self.assertIsNotNone(policy) |
292 | 298 | self.assertEqual(policy.get_alert_for_score(9.5), "ok") |
293 | 299 | self.assertEqual(policy.get_alert_for_score(8.0), "warning") |
294 | 300 | self.assertEqual(policy.get_alert_for_score(5.0), "error") |
295 | 301 |
|
296 | 302 | def test_load_from_nonexistent_file(self): |
297 | | - policy = load_thresholds_from_file("/nonexistent/file.yml", ScorecardThresholdsPolicy) |
| 303 | + policy = load_thresholds_from_file( |
| 304 | + "/nonexistent/file.yml", ScorecardThresholdsPolicy |
| 305 | + ) |
298 | 306 | self.assertIsNone(policy) |
299 | | - |
|
0 commit comments