From 47a42d897ec890cbe06b2e1401f5ceaa8c752608 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 24 Feb 2024 17:01:14 +0100 Subject: [PATCH] =?UTF-8?q?Test=20unitaire=20=C3=A9valuation=20bonus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_notes_rattrapage.py | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/unit/test_notes_rattrapage.py b/tests/unit/test_notes_rattrapage.py index 4dfaee33..4435cb2f 100644 --- a/tests/unit/test_notes_rattrapage.py +++ b/tests/unit/test_notes_rattrapage.py @@ -183,3 +183,43 @@ def test_notes_rattrapage(test_client): ) # Note moyenne: revient à note normale assert b["ues"][0]["modules"][0]["mod_moy_txt"] == scu.fmt_note(10.0) + # Supprime évaluation session 2 + _, _, _ = G.create_note( + evaluation_id=e_session2["id"], etudid=etud["etudid"], note=scu.NOTES_SUPPRESS + ) + evaluation = db.session.get(Evaluation, e_session2["id"]) + assert evaluation + evaluation.delete() + # + # --- Evaluation bonus --- + # + # --- Création d'une évaluation "bonus" + e_bonus = G.create_evaluation( + moduleimpl_id=moduleimpl_id, + date_debut=datetime.datetime(2020, 1, 2), + description="evaluation bonus", + coefficient=1.0, + evaluation_type=Evaluation.EVALUATION_BONUS, + ) + b = sco_bulletins.formsemestre_bulletinetud_dict( + sem["formsemestre_id"], etud["etudid"] + ) + # Note moyenne sans bonus + assert b["ues"][0]["modules"][0]["mod_moy_txt"] == scu.fmt_note(10.0) + # Saisie note bonus + _, _, _ = G.create_note( + evaluation_id=e_bonus["id"], etudid=etud["etudid"], note=1.0 + ) + b = sco_bulletins.formsemestre_bulletinetud_dict( + sem["formsemestre_id"], etud["etudid"] + ) + # Note moyenne sans bonus + assert b["ues"][0]["modules"][0]["mod_moy_txt"] == scu.fmt_note(11.0) + # Négatif, avec clip à zéro + _, _, _ = G.create_note( + evaluation_id=e_bonus["id"], etudid=etud["etudid"], note=-20.0 + ) + b = sco_bulletins.formsemestre_bulletinetud_dict( + sem["formsemestre_id"], etud["etudid"] + ) + assert b["ues"][0]["modules"][0]["mod_moy_txt"] == scu.fmt_note(0.0)