Skip to content

Commit 9734e49

Browse files
committed
fix(pylint): fix pylint issues
1 parent 13ec372 commit 9734e49

6 files changed

Lines changed: 21 additions & 24 deletions

tests/acceptance_only_changed_get_uploaded_usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def _build_parameter_editor_window(root: object) -> tuple[ParameterEditorWindow,
6060
cast("Any", window).ui = ui
6161
cast("Any", window).upload_selected_params = upload_params
6262
cast("Any", window).on_skip_click = on_skip
63-
cast("Any", window)._log_availability_report_window = None
64-
cast("Any", window)._log_report_return_pending = False
63+
cast("Any", window)._log_availability_report_window = None # pylint: disable=protected-access
64+
cast("Any", window)._log_report_return_pending = False # pylint: disable=protected-access
6565

6666
mocks = {
6767
"write_changes": write_changes,

tests/test_data_model_availability_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_esc_analysis_does_not_report_zero_error_rates_as_findings() -> None:
195195

196196
outcomes = EscLogAnalysis(log_data, _context({})).check_per_instance_errors()
197197

198-
assert outcomes == []
198+
assert not outcomes
199199

200200

201201
def test_esc_analysis_ignores_a_single_zero_rpm_sample() -> None:
@@ -212,7 +212,7 @@ def test_esc_analysis_ignores_a_single_zero_rpm_sample() -> None:
212212

213213
outcomes = EscLogAnalysis(log_data, _context({})).check_rpm_while_armed()
214214

215-
assert outcomes == []
215+
assert not outcomes
216216

217217

218218
def test_esc_analysis_skips_dshot_rate_for_pwm_output() -> None:
@@ -228,4 +228,4 @@ def test_esc_analysis_skips_dshot_rate_for_pwm_output() -> None:
228228
),
229229
)
230230

231-
assert model.check_dshot_output_rate() == []
231+
assert not model.check_dshot_output_rate()

tests/test_extract_missing_translations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Add the parent directory to the path to import the script
2323
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../.github/skills/update-gui-translations/scripts")))
2424

25-
# pylint: disable=wrong-import-position
25+
# pylint: disable=wrong-import-position,import-error
2626
import extract_missing_translations # type: ignore[import-not-found] # ty: ignore[unresolved-import]
2727

2828
# pylint: enable=wrong-import-position

tests/test_frontend_tkinter_log_analysis.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _make_availability_issue(message: str = "issue", config_step: str | None = N
5050
return issue
5151

5252

53-
def _make_availability_result(
53+
def _make_availability_result( # pylint: disable=too-many-arguments
5454
*,
5555
name: str = "Battery",
5656
available: bool = True,
@@ -266,7 +266,7 @@ def test_ignores_step_info_with_no_urls_at_all(self) -> None:
266266

267267
links = _collect_links(availability_dict, None)
268268

269-
assert links == []
269+
assert not links
270270

271271
def test_returns_empty_list_when_no_availability_or_analysis_dicts_given(self) -> None:
272272
"""
@@ -278,7 +278,7 @@ def test_returns_empty_list_when_no_availability_or_analysis_dicts_given(self) -
278278
"""
279279
links = _collect_links(None, None)
280280

281-
assert links == []
281+
assert not links
282282

283283
def test_ignores_issues_or_outcomes_missing_step_info_key(self) -> None:
284284
"""
@@ -292,7 +292,7 @@ def test_ignores_issues_or_outcomes_missing_step_info_key(self) -> None:
292292

293293
links = _collect_links(availability_dict, None)
294294

295-
assert links == []
295+
assert not links
296296

297297

298298
class TestFormatComponent:
@@ -324,7 +324,7 @@ def test_skips_empty_manufacturer_and_model(self) -> None:
324324

325325
lines = _format_component(component)
326326

327-
assert lines == []
327+
assert not lines
328328

329329
def test_formats_firmware_type_and_version(self) -> None:
330330
"""
@@ -377,7 +377,7 @@ def test_returns_empty_list_for_completely_empty_component(self) -> None:
377377
WHEN: The component is formatted
378378
THEN: The result is an empty list
379379
"""
380-
assert _format_component({}) == []
380+
assert not _format_component({})
381381

382382
def test_ignores_non_dict_connection_like_values(self) -> None:
383383
"""
@@ -391,7 +391,7 @@ def test_ignores_non_dict_connection_like_values(self) -> None:
391391

392392
lines = _format_component(component)
393393

394-
assert lines == []
394+
assert not lines
395395

396396

397397
@pytest.fixture
@@ -424,7 +424,7 @@ def bare_window() -> LogAnalysisReportWindow:
424424
class TestWindowConstruction:
425425
"""Cover LogAnalysisReportWindow's full __init__ flow with widgets mocked."""
426426

427-
def _build_window(
427+
def _build_window( # pylint: disable=too-many-arguments
428428
self,
429429
mocker: MockerFixture,
430430
patched_widgets: dict[str, MagicMock],
@@ -434,6 +434,7 @@ def _build_window(
434434
report: dict | None = None,
435435
vehicle_dir: str = "/vehicle",
436436
) -> LogAnalysisReportWindow:
437+
_ = patched_widgets # Keep the widget patches active while constructing the window.
437438
mocker.patch.object(LogAnalysisReportWindow, "calculate_scaled_geometry", return_value="1050x800")
438439
mocker.patch.object(LogAnalysisReportWindow, "center_window")
439440
summary = _make_summary(availability_results, analysis_results)
@@ -464,7 +465,7 @@ def test_selector_defaults_to_first_subsystem(self, mocker: MockerFixture, patch
464465
mocker, patched_widgets, [availability_battery, availability_imu], [analysis_battery, analysis_imu]
465466
)
466467

467-
window.selector.set.assert_called_once_with("Battery")
468+
cast("MagicMock", window.selector.set).assert_called_once_with("Battery")
468469

469470
def test_no_selector_default_when_no_subsystems_present(
470471
self, mocker: MockerFixture, patched_widgets: dict[str, MagicMock]
@@ -478,15 +479,13 @@ def test_no_selector_default_when_no_subsystems_present(
478479
"""
479480
window = self._build_window(mocker, patched_widgets, [], [])
480481

481-
window.selector.set.assert_not_called()
482+
cast("MagicMock", window.selector.set).assert_not_called()
482483

483484

484485
class TestTuningGraphButton:
485486
"""Cover the footer's Tuning Parameter Graph button state and click handler."""
486487

487-
def test_button_enabled_when_tuning_report_exists(
488-
self, mocker: MockerFixture, patched_widgets: dict[str, MagicMock], tmp_path: Path
489-
) -> None:
488+
def test_button_enabled_when_tuning_report_exists(self, patched_widgets: dict[str, MagicMock], tmp_path: Path) -> None:
490489
"""
491490
The tuning graph button is enabled when tuning_report.csv exists in the vehicle directory.
492491
@@ -505,9 +504,7 @@ def test_button_enabled_when_tuning_report_exists(
505504
button_mock = patched_widgets["button"].return_value
506505
button_mock.configure.assert_any_call(state="normal")
507506

508-
def test_button_disabled_when_tuning_report_missing(
509-
self, mocker: MockerFixture, patched_widgets: dict[str, MagicMock], tmp_path: Path
510-
) -> None:
507+
def test_button_disabled_when_tuning_report_missing(self, patched_widgets: dict[str, MagicMock], tmp_path: Path) -> None:
511508
"""
512509
The tuning graph button is disabled when tuning_report.csv is absent.
513510

tests/test_frontend_tkinter_log_quality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_availability_fix_accepts_non_false_upload_result(upload_result: bool |
6262
fixes = [("MOT_SPIN_MIN", 0.1, 0.15, ["finding"])]
6363

6464
# Act: apply the proposed change.
65-
window._apply_param_fixes(fixes, dialog)
65+
window._apply_param_fixes(fixes, dialog) # pylint: disable=protected-access
6666

6767
# Assert: None is not mistaken for an upload failure.
6868
assert window.summary.related_parameter_values == {"MOT_SPIN_MIN": 0.15}

tests/unit_backend_log_extraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def test_second_pass_reports_progress_against_known_message_count(self) -> None:
325325
assert progress_calls == [(1, 3), (2, 3), (3, 3)]
326326

327327

328-
class TestExtractSchemas: # pylint: disable=too-few-public-methods
328+
class TestExtractSchemas:
329329
"""Tests for extract_schemas()."""
330330

331331
def test_extract_schemas_populates_message_schema(self, empty_log_data: LogData) -> None: # pylint: disable=redefined-outer-name

0 commit comments

Comments
 (0)