Skip to content

Commit f46e98d

Browse files
committed
fix: update test mocks to return tuples matching _extract_band signature
1 parent 9020f26 commit f46e98d

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

tests/test_copernicus_s2_processing.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ def test_calculate_ndvi(self, mock_extract):
135135
# Mock NIR and Red bands
136136
nir = np.ones((100, 100), dtype=np.float32) * 0.8
137137
red = np.ones((100, 100), dtype=np.float32) * 0.2
138+
bounds = (-180, -90, 180, 90)
138139

139-
mock_extract.side_effect = [nir, red]
140+
mock_extract.side_effect = [(nir, bounds), (red, bounds)]
140141

141142
result = calculate_ndvi(Path("fake.zip"))
142143

@@ -161,8 +162,9 @@ def test_calculate_ndwi(self, mock_extract):
161162
"""Test NDWI calculation."""
162163
green = np.ones((100, 100), dtype=np.float32) * 0.6
163164
nir = np.ones((100, 100), dtype=np.float32) * 0.2
165+
bounds = (-180, -90, 180, 90)
164166

165-
mock_extract.side_effect = [green, nir]
167+
mock_extract.side_effect = [(green, bounds), (nir, bounds)]
166168

167169
result = calculate_ndwi(Path("fake.zip"))
168170

@@ -177,8 +179,9 @@ def test_calculate_evi(self, mock_extract):
177179
nir = np.ones((100, 100), dtype=np.float32) * 0.8
178180
red = np.ones((100, 100), dtype=np.float32) * 0.2
179181
blue = np.ones((100, 100), dtype=np.float32) * 0.1
182+
bounds = (-180, -90, 180, 90)
180183

181-
mock_extract.side_effect = [nir, red, blue]
184+
mock_extract.side_effect = [(nir, bounds), (red, bounds), (blue, bounds)]
182185

183186
result = calculate_evi(Path("fake.zip"))
184187

@@ -191,8 +194,9 @@ def test_calculate_savi(self, mock_extract):
191194
"""Test SAVI calculation."""
192195
nir = np.ones((100, 100), dtype=np.float32) * 0.8
193196
red = np.ones((100, 100), dtype=np.float32) * 0.2
197+
bounds = (-180, -90, 180, 90)
194198

195-
mock_extract.side_effect = [nir, red]
199+
mock_extract.side_effect = [(nir, bounds), (red, bounds)]
196200

197201
result = calculate_savi(Path("fake.zip"), L=0.5)
198202

@@ -205,8 +209,9 @@ def test_calculate_nbr(self, mock_extract):
205209
"""Test NBR calculation."""
206210
nir = np.ones((100, 100), dtype=np.float32) * 0.8
207211
swir = np.ones((100, 100), dtype=np.float32) * 0.2
212+
bounds = (-180, -90, 180, 90)
208213

209-
mock_extract.side_effect = [nir, swir]
214+
mock_extract.side_effect = [(nir, bounds), (swir, bounds)]
210215

211216
result = calculate_nbr(Path("fake.zip"))
212217

0 commit comments

Comments
 (0)