@@ -231,32 +231,92 @@ def test_write_headers(mock_print, mock_file):
231
231
232
232
233
233
def test_check_vac_eligibility_eligible ():
234
- """Test the check_vac_eligibility function."""
234
+ """Test the check_vac_eligibility function when eligible ."""
235
235
236
236
person = mock .Mock (status = "susceptible" , antivax = False , symptoms_suppressed = False )
237
237
238
238
assert utils .check_vac_eligibility (person ) is True
239
239
240
240
241
241
def test_check_vac_eligibility_not_eligible_status ():
242
- """Test the check_vac_eligibility function."""
242
+ """Test the check_vac_eligibility function when infected ."""
243
243
244
244
person = mock .Mock (status = "infected" , antivax = False , symptoms_suppressed = False )
245
245
246
246
assert utils .check_vac_eligibility (person ) is False
247
247
248
248
249
249
def test_check_vac_eligibility_not_eligible_antivax ():
250
- """Test the check_vac_eligibility function."""
250
+ """Test the check_vac_eligibility function when antivax ."""
251
251
252
252
person = mock .Mock (status = "susceptible" , antivax = True , symptoms_suppressed = False )
253
253
254
254
assert utils .check_vac_eligibility (person ) is False
255
255
256
256
257
257
def test_check_vac_eligibility_not_eligible_suppressed ():
258
- """Test the check_vac_eligibility function."""
258
+ """Test the check_vac_eligibility function when symptoms suppressed ."""
259
259
260
260
person = mock .Mock (status = "susceptible" , antivax = False , symptoms_suppressed = True )
261
261
262
262
assert utils .check_vac_eligibility (person ) is False
263
+
264
+
265
+ def test_interpolation_single_point ():
266
+ """Test the get_interpolated_lists function with a single point."""
267
+
268
+ data = [[0 , 10.0 ]]
269
+ interpolated_size = 5
270
+ expected_result = [10.0 ] * interpolated_size
271
+ result = utils .get_interpolated_lists (interpolated_size , data )
272
+ assert result == expected_result
273
+
274
+
275
+ def test_interpolation_linear_data ():
276
+ """Test the get_interpolated_lists function with linear data."""
277
+
278
+ data = [[0 , 0.0 ], [10 , 10.0 ]]
279
+ interpolated_size = 11
280
+ expected_result = [float (i ) for i in range (interpolated_size )]
281
+ result = utils .get_interpolated_lists (interpolated_size , data )
282
+ assert result == expected_result
283
+
284
+
285
+ def test_interpolation_out_of_bounds ():
286
+ """Test the get_interpolated_lists function with data outside the bounds."""
287
+
288
+ data = [[1 , 1.0 ], [2 , 2.0 ]]
289
+ interpolated_size = 5
290
+ expected_result = [1.0 , 1.0 , 2.0 , 2.0 , 2.0 ]
291
+ result = utils .get_interpolated_lists (interpolated_size , data )
292
+ assert result == expected_result
293
+
294
+
295
+ def test_interpolation_with_real_numbers ():
296
+ """Test the get_interpolated_lists function with real numbers."""
297
+
298
+ data = [[0.5 , 1.5 ], [1.5 , 2.5 ]]
299
+ interpolated_size = 3
300
+ expected_result = [1.5 , 2.0 , 2.5 ]
301
+ result = utils .get_interpolated_lists (interpolated_size , data )
302
+ assert result == expected_result
303
+
304
+
305
+ def test_empty_data ():
306
+ """Test the get_interpolated_lists function with empty data."""
307
+
308
+ data = []
309
+ interpolated_size = 3
310
+
311
+ with pytest .raises (IndexError ):
312
+ _ = utils .get_interpolated_lists (interpolated_size , data )
313
+
314
+
315
+ def test_invalid_data ():
316
+ """Test the get_interpolated_lists function with invalid data."""
317
+
318
+ data = None
319
+ interpolated_size = 3
320
+
321
+ with pytest .raises (IndexError ):
322
+ _ = utils .get_interpolated_lists (interpolated_size , data )
0 commit comments