@@ -273,7 +273,7 @@ def test_parameter_uprating_two_year_offset():
273
273
assert uprated .to_be_uprated ("2020-04-01" ) == 32
274
274
assert uprated .to_be_uprated ("2021-04-01" ) == 64
275
275
276
- def test_parameter_uprating_cadence_custom_start ():
276
+ def test_parameter_uprating_cadence_custom_effective ():
277
277
"""
278
278
Test custom start date for uprating
279
279
"""
@@ -329,6 +329,59 @@ def test_parameter_uprating_cadence_custom_start():
329
329
assert uprated .to_be_uprated ("2020-04-01" ) == 8
330
330
assert uprated .to_be_uprated ("2021-04-01" ) == 16
331
331
332
+ def test_parameter_uprating_cadence_custom_effective_malformed ():
333
+ """
334
+ Test that malformed custom effective date for uprating raises error
335
+ """
336
+
337
+ from policyengine_core .parameters import ParameterNode
338
+
339
+ # Create the parameter
340
+
341
+ root = ParameterNode (
342
+ data = {
343
+ "to_be_uprated" : {
344
+ "description" : "Example parameter" ,
345
+ "values" : {
346
+ "2015-04-01" : 1 ,
347
+ "2016-04-01" : 2 ,
348
+ "2017-04-01" : 4
349
+ },
350
+ "metadata" : {
351
+ "uprating" : {
352
+ "parameter" : "uprater" ,
353
+ "at_defined_interval" : {
354
+ "enactment" : "0002-04-01" ,
355
+ "start" : "0000-10-01" ,
356
+ "end" : "0001-10-01" ,
357
+ "effective" : "dworkin"
358
+ }
359
+ },
360
+ },
361
+ },
362
+ "uprater" : {
363
+ "description" : "Uprater" ,
364
+ "values" : {
365
+ "2015-10-01" : 1 ,
366
+ "2015-12-01" : 1 ,
367
+ "2016-10-01" : 2 ,
368
+ "2016-12-01" : 1 ,
369
+ "2017-10-01" : 4 ,
370
+ "2017-12-01" : 1 ,
371
+ "2018-10-01" : 8 ,
372
+ "2019-10-01" : 16 ,
373
+ "2020-10-01" : 32
374
+ },
375
+ },
376
+ }
377
+ )
378
+
379
+ from policyengine_core .parameters import uprate_parameters
380
+
381
+ with pytest .raises (ValueError ):
382
+ uprated = uprate_parameters (root )
383
+
384
+
332
385
def test_parameter_uprating_missing_data ():
333
386
"""
334
387
Test that, if missing a cadence start value,
0 commit comments