From 2cc8b80d9edfe31465788c438800168984798149 Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Fri, 16 Feb 2024 17:44:57 +0100 Subject: [PATCH] fix for debian 11 and python 3.9 --- backend/geonature/tests/fixtures.py | 4 ++-- backend/geonature/tests/test_synthese.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/geonature/tests/fixtures.py b/backend/geonature/tests/fixtures.py index dc6a90fed6..368f8a68cd 100644 --- a/backend/geonature/tests/fixtures.py +++ b/backend/geonature/tests/fixtures.py @@ -684,7 +684,7 @@ def synthese_with_protected_status(users, datasets, source): pytest.Fixture fixture with synthese observations """ - synthese_element = {} + synthese_element = [] # Retrieve protected taxon from the bdc_statut_taxons table protected_taxon = db.session.scalars( @@ -711,7 +711,7 @@ def synthese_with_protected_status(users, datasets, source): cor_observers=[users["self_user"]], ) db.session.add(synthese) - synthese_element[taxon.cd_nom] = synthese + synthese_element.append(synthese) return synthese_element diff --git a/backend/geonature/tests/test_synthese.py b/backend/geonature/tests/test_synthese.py index f311a85832..5595d73cb3 100644 --- a/backend/geonature/tests/test_synthese.py +++ b/backend/geonature/tests/test_synthese.py @@ -905,8 +905,11 @@ def assert_export_status_results(user, set_expected_cd_ref): user = users["user"] set_expected_cd_ref = set( - db.session.scalars(select(Taxref.cd_ref).where(Taxref.cd_nom == obs.cd_nom)).one() - for obs in synthese_with_protected_status.values() + db.session.scalars( + select(Taxref.cd_ref).where( + Taxref.cd_nom.in_([el.cd_nom for el in synthese_with_protected_status]) + ) + ).all() ) assert_export_status_results(user, set_expected_cd_ref)