Spaces:
Running
Fix lint tests/ — 9 erreurs ruff résolues
Browse filesLe job lint du CI exécute aussi `ruff check tests/`. Les tests
introduits dans les sprints 16 à 21 avaient 8 imports non utilisés
(F401) + 1 variable à nom ambigu (E741) :
- test_sprint16 : retrait de `tempfile` et `pytest` (jamais invoqués).
- test_sprint17 : renommage `l` → `line` dans la génératrice.
- test_sprint18 : retrait de `ReportGenerator` (seul `_build_report_data`
est utilisé dans ce test précis).
- test_sprint19 : retrait de `DetectorRegistry`, `detect_all`,
`register_default_detectors` — les tests manipulent les classes
nommées directement.
- test_sprint20 : retrait de `EngineCost` (on n'en construit pas
explicitement dans les tests, on compare le `as_dict`).
- test_sprint21 : retrait de `Path` (les chemins viennent du loader).
Tous les tests des sprints concernés restent verts (169/169).
https://claude.ai/code/session_0162FdNNJyNvBuYzkgtsr9VB
|
@@ -13,11 +13,8 @@ Couverture :
|
|
| 13 |
from __future__ import annotations
|
| 14 |
|
| 15 |
import json
|
| 16 |
-
import tempfile
|
| 17 |
from pathlib import Path
|
| 18 |
|
| 19 |
-
import pytest
|
| 20 |
-
|
| 21 |
from picarones.core.corpus import Corpus, Document
|
| 22 |
from picarones.core.narrative import (
|
| 23 |
DetectorRegistry,
|
|
|
|
| 13 |
from __future__ import annotations
|
| 14 |
|
| 15 |
import json
|
|
|
|
| 16 |
from pathlib import Path
|
| 17 |
|
|
|
|
|
|
|
| 18 |
from picarones.core.corpus import Corpus, Document
|
| 19 |
from picarones.core.narrative import (
|
| 20 |
DetectorRegistry,
|
|
@@ -186,7 +186,7 @@ class TestTemplateContent:
|
|
| 186 |
|
| 187 |
def test_app_js_starts_with_use_strict(self):
|
| 188 |
js = (_TEMPLATES_DIR / "_app.js").read_text(encoding="utf-8")
|
| 189 |
-
first_nonblank = next((
|
| 190 |
assert "'use strict'" in first_nonblank
|
| 191 |
|
| 192 |
def test_app_js_has_no_residual_script_tag(self):
|
|
|
|
| 186 |
|
| 187 |
def test_app_js_starts_with_use_strict(self):
|
| 188 |
js = (_TEMPLATES_DIR / "_app.js").read_text(encoding="utf-8")
|
| 189 |
+
first_nonblank = next((line for line in js.splitlines() if line.strip()), "")
|
| 190 |
assert "'use strict'" in first_nonblank
|
| 191 |
|
| 192 |
def test_app_js_has_no_residual_script_tag(self):
|
|
@@ -328,7 +328,7 @@ class TestReportIntegration:
|
|
| 328 |
assert "cd-tie" in html
|
| 329 |
|
| 330 |
def test_report_json_contains_friedman_and_nemenyi(self, benchmark_result, tmp_path):
|
| 331 |
-
from picarones.report.generator import
|
| 332 |
data = _build_report_data(benchmark_result, images_b64={})
|
| 333 |
stats = data.get("statistics", {})
|
| 334 |
assert "friedman" in stats
|
|
|
|
| 328 |
assert "cd-tie" in html
|
| 329 |
|
| 330 |
def test_report_json_contains_friedman_and_nemenyi(self, benchmark_result, tmp_path):
|
| 331 |
+
from picarones.report.generator import _build_report_data
|
| 332 |
data = _build_report_data(benchmark_result, images_b64={})
|
| 333 |
stats = data.get("statistics", {})
|
| 334 |
assert "friedman" in stats
|
|
@@ -16,14 +16,11 @@ import re
|
|
| 16 |
import pytest
|
| 17 |
|
| 18 |
from picarones.core.narrative import (
|
| 19 |
-
DetectorRegistry,
|
| 20 |
Fact,
|
| 21 |
FactImportance,
|
| 22 |
FactType,
|
| 23 |
build_synthesis,
|
| 24 |
-
detect_all,
|
| 25 |
extract_numbers,
|
| 26 |
-
register_default_detectors,
|
| 27 |
render_fact,
|
| 28 |
render_synthesis,
|
| 29 |
select_facts,
|
|
|
|
| 16 |
import pytest
|
| 17 |
|
| 18 |
from picarones.core.narrative import (
|
|
|
|
| 19 |
Fact,
|
| 20 |
FactImportance,
|
| 21 |
FactType,
|
| 22 |
build_synthesis,
|
|
|
|
| 23 |
extract_numbers,
|
|
|
|
| 24 |
render_fact,
|
| 25 |
render_synthesis,
|
| 26 |
select_facts,
|
|
@@ -22,7 +22,6 @@ from picarones.core.narrative.detectors import (
|
|
| 22 |
)
|
| 23 |
from picarones.core.narrative.facts import FactType
|
| 24 |
from picarones.core.pricing import (
|
| 25 |
-
EngineCost,
|
| 26 |
build_costs_for_benchmark,
|
| 27 |
estimate_cost,
|
| 28 |
load_pricing_database,
|
|
|
|
| 22 |
)
|
| 23 |
from picarones.core.narrative.facts import FactType
|
| 24 |
from picarones.core.pricing import (
|
|
|
|
| 25 |
build_costs_for_benchmark,
|
| 26 |
estimate_cost,
|
| 27 |
load_pricing_database,
|
|
@@ -13,7 +13,6 @@ from __future__ import annotations
|
|
| 13 |
|
| 14 |
import json
|
| 15 |
import re
|
| 16 |
-
from pathlib import Path
|
| 17 |
|
| 18 |
import pytest
|
| 19 |
|
|
|
|
| 13 |
|
| 14 |
import json
|
| 15 |
import re
|
|
|
|
| 16 |
|
| 17 |
import pytest
|
| 18 |
|