From 9541b674a796ba18d2d5d3d95b5125ac910cd50e Mon Sep 17 00:00:00 2001 From: jsboige Date: Tue, 6 Oct 2026 18:36:42 +0200 Subject: [PATCH] test(notebooks,#19478): couvrir l'exclusion *_output.ipynb isole L'organe `check_series_finish` exclut par dossier (`_archive`, `_output`, `.ipynb_checkpoints`) ET par suffixe de fichier (`*_output.ipynb`, ligne 130 de check_series_finish.py -- deja livre par #19303). Le test manquant : un `X_output.ipynb` isole hors dossier `_output` n'est pas comptabilise comme carnet de la serie. Couverture ajoutee dans `test_serie_exclut_fichier_output_isole`, qui verifie aussi le non-match strict du suffixe (`_output_archive.ipynb` compte). 32/32 tests verts (`pytest scripts/tests/test_check_series_finish.py -v` au commit 17789660b + ce commit). Co-Authored-By: Claude Haiku 4.5 (1M context) --- scripts/tests/test_check_series_finish.py | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/tests/test_check_series_finish.py b/scripts/tests/test_check_series_finish.py index 0589d68e17..e6e6a526d5 100644 --- a/scripts/tests/test_check_series_finish.py +++ b/scripts/tests/test_check_series_finish.py @@ -466,6 +466,36 @@ def test_serie_exclut_archive_et_output(self, tmp_path): finally: mod.SERIES_ROOT = original + def test_serie_exclut_fichier_output_isole(self, tmp_path): + """#19478 point 2 : un `X_output.ipynb` isole hors dossier `_output` n'est pas un carnet de la serie.""" + original = mod.SERIES_ROOT + try: + mod.SERIES_ROOT = str(tmp_path) + serie = tmp_path / "SerieFiltr" + serie.mkdir() + (serie / "README.md").write_text("## Objectifs\nblah\n", encoding="utf-8") + # Carnet canonique : compte + _make_notebook( + serie / "C-1-Python.ipynb", + ["## A retenir", "## Verifiez votre comprehension", "## Pour aller plus loin"], + ) + # Fichier hors dossier `_output` mais avec suffixe `_output.ipynb` : ne compte pas + _make_notebook( + serie / "C-2-Python_output.ipynb", + [], # pas de blocs, mais il ne doit pas etre compte + ) + # Fichier avec suffixe `_output_archive.ipynb` (mensonge) : compte, pas un match exact + _make_notebook( + serie / "C-3-Python_output_archive.ipynb", + ["## A retenir", "## Verifiez votre comprehension", "## Pour aller plus loin"], + ) + result = mod.run_check("SerieFiltr") + assert result["carnet_total"] == 2 + assert result["carnet_finis"] == 2 + assert result["finished"] is True + finally: + mod.SERIES_ROOT = original + def test_serie_mesure_recursive(self, tmp_path): """Les carnets en sous-dossiers (depth >= 2) comptent dans la mesure (leçon #19297).""" original = mod.SERIES_ROOT