55
66from envergo .geodata .models import MAP_TYPES
77from envergo .geodata .tests .factories import MapFactory , france_polygon
8- from envergo .hedges .tests .factories import HedgeDataFactory
98from envergo .moulinette .tests .factories import RUConfigHaieFactory
109from envergo .moulinette .tests .utils import (
1110 make_hedge ,
@@ -84,10 +83,9 @@ def test_ep_ru_ripisylve_above_threshold(ep_ru_criterion):
8483def test_ep_ru_short_total_dispense (ep_ru_criterion ):
8584 """Total length <= 10m → dispense."""
8685 RUConfigHaieFactory ()
87- hedge = make_hedge_factory (length = 8 )
88- hedges = HedgeDataFactory (hedges = [hedge ])
8986 moulinette = make_moulinette_haie_with_density (
90- density = 60 , hedges = hedges , reimplantation = "replantation" ,
87+ density = 60 , hedges = [make_hedge_factory (length = 8 )],
88+ reimplantation = "replantation" ,
9189 )
9290 assert moulinette .catalog ["ep_ru_total_length" ] <= 10
9391 assert moulinette .ep .ep_regime_unique .result_code == "dispense"
@@ -96,10 +94,9 @@ def test_ep_ru_short_total_dispense(ep_ru_criterion):
9694def test_ep_ru_medium_total_moderate_density (ep_ru_criterion ):
9795 """10m < total <= 100m and density < 80 → derogation_simplifiee."""
9896 RUConfigHaieFactory ()
99- hedge = make_hedge_factory (length = 50 )
100- hedges = HedgeDataFactory (hedges = [hedge ])
10197 moulinette = make_moulinette_haie_with_density (
102- density = 60 , hedges = hedges , reimplantation = "replantation" ,
98+ density = 60 , hedges = [make_hedge_factory (length = 50 )],
99+ reimplantation = "replantation" ,
103100 )
104101 total = moulinette .catalog ["ep_ru_total_length" ]
105102 assert 10 < total <= 100
@@ -109,10 +106,9 @@ def test_ep_ru_medium_total_moderate_density(ep_ru_criterion):
109106def test_ep_ru_long_total_low_density (ep_ru_criterion ):
110107 """Total > 100m and density < 50 → derogation_inventaire."""
111108 RUConfigHaieFactory ()
112- hedge = make_hedge_factory (length = 120 )
113- hedges = HedgeDataFactory (hedges = [hedge ])
114109 moulinette = make_moulinette_haie_with_density (
115- density = 40 , hedges = hedges , reimplantation = "replantation" ,
110+ density = 40 , hedges = [make_hedge_factory (length = 120 )],
111+ reimplantation = "replantation" ,
116112 )
117113 assert moulinette .catalog ["ep_ru_total_length" ] > 100
118114 assert moulinette .ep .ep_regime_unique .result_code == "derogation_inventaire"
@@ -131,11 +127,10 @@ def test_ep_ru_per_hedge_zone_sensible(ep_ru_criterion):
131127 map_type = MAP_TYPES .zone_sensible_ep ,
132128 zones__geometry = MultiPolygon ([france_polygon ]),
133129 )
134- hedge = make_hedge_factory (length = 120 )
135- hedges = HedgeDataFactory (hedges = [hedge ])
136130 # density between D_BAS and D_HAUT so project-level rules don't short-circuit
137131 moulinette = make_moulinette_haie_with_density (
138- density = 65 , hedges = hedges , reimplantation = "replantation" ,
132+ density = 65 , hedges = [make_hedge_factory (length = 120 )],
133+ reimplantation = "replantation" ,
139134 )
140135 assert moulinette .catalog ["ep_ru_total_length" ] > 100
141136 assert moulinette .ep .ep_regime_unique .result_code == "derogation_inventaire"
@@ -144,10 +139,9 @@ def test_ep_ru_per_hedge_zone_sensible(ep_ru_criterion):
144139def test_ep_ru_per_hedge_high_density_no_zone_sensible (ep_ru_criterion ):
145140 """High density + no zone sensible → dispense via per-hedge."""
146141 RUConfigHaieFactory ()
147- hedge = make_hedge_factory (length = 120 )
148- hedges = HedgeDataFactory (hedges = [hedge ])
149142 moulinette = make_moulinette_haie_with_density (
150- density = 90 , hedges = hedges , reimplantation = "replantation" ,
143+ density = 90 , hedges = [make_hedge_factory (length = 120 )],
144+ reimplantation = "replantation" ,
151145 )
152146 assert moulinette .catalog ["ep_ru_total_length" ] > 100
153147 assert moulinette .ep .ep_regime_unique .result_code == "dispense"
@@ -156,11 +150,10 @@ def test_ep_ru_per_hedge_high_density_no_zone_sensible(ep_ru_criterion):
156150def test_ep_ru_per_hedge_fallback_derogation_simplifiee (ep_ru_criterion ):
157151 """Medium density, long total, no zone sensible → derogation_simplifiee."""
158152 RUConfigHaieFactory ()
159- hedge = make_hedge_factory (length = 120 )
160- hedges = HedgeDataFactory (hedges = [hedge ])
161153 # density between D_BAS and D_HAUT, no zone sensible → fallback
162154 moulinette = make_moulinette_haie_with_density (
163- density = 65 , hedges = hedges , reimplantation = "replantation" ,
155+ density = 65 , hedges = [make_hedge_factory (length = 120 )],
156+ reimplantation = "replantation" ,
164157 )
165158 assert moulinette .catalog ["ep_ru_total_length" ] > 100
166159 assert moulinette .ep .ep_regime_unique .result_code == "derogation_simplifiee"
@@ -189,10 +182,9 @@ def test_ep_ru_replantation_coefficient(
189182):
190183 """Replantation coefficient = R_ru + bonus per result level."""
191184 RUConfigHaieFactory ()
192- hedge = make_hedge_factory (length = length )
193- hedges = HedgeDataFactory (hedges = [hedge ])
194185 moulinette = make_moulinette_haie_with_density (
195- density = density , hedges = hedges , reimplantation = "replantation" ,
186+ density = density , hedges = [make_hedge_factory (length = length )],
187+ reimplantation = "replantation" ,
196188 )
197189 criterion = moulinette .ep .ep_regime_unique
198190 assert criterion .result_code == expected_code
0 commit comments