Skip to content

Commit

Permalink
Updated test_engine to use JSON inputs
Browse files Browse the repository at this point in the history
Co-authored-by: Erika Nesse <[email protected]>
Co-authored-by: dwindleduck <[email protected]>
Co-authored-by: Alan Pinkert <[email protected]>
Co-authored-by: David Egan <[email protected]>
Co-authored-by: thatoldplatitude <[email protected]>
  • Loading branch information
6 people committed Jan 3, 2024
1 parent be3a5e3 commit 7a88184
Showing 1 changed file with 61 additions and 55 deletions.
116 changes: 61 additions & 55 deletions rules-engine/tests/test_rules_engine/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,30 +153,31 @@ def test_bp_ua_with_outlier():


def test_convert_to_intermediate_billing_periods():
temperature_input = TemperatureInput(
dates=[
date(2022, 12, 1),
date(2022, 12, 2),
date(2022, 12, 3),
date(2022, 12, 4),
date(2023, 1, 1),
date(2023, 1, 2),
date(2023, 1, 3),
date(2023, 1, 4),
date(2023, 2, 1),
date(2023, 2, 2),
date(2023, 2, 3),
date(2023, 2, 4),
date(2023, 3, 1),
date(2023, 3, 2),
date(2023, 3, 3),
date(2023, 3, 4),
date(2023, 4, 1),
date(2023, 4, 2),
date(2023, 4, 3),
date(2023, 4, 4),

temperature_dict = {
'dates':[
'2022-12-01',
'2022-12-02',
'2022-12-03',
'2022-12-04',
'2023-01-01',
'2023-01-02',
'2023-01-03',
'2023-01-04',
'2023-02-01',
'2023-02-02',
'2023-02-03',
'2023-02-04',
'2023-03-01',
'2023-03-02',
'2023-03-03',
'2023-03-04',
'2023-04-01',
'2023-04-02',
'2023-04-03',
'2023-04-04',
],
temperatures=[
'temperatures':[
41.7,
41.6,
32,
Expand All @@ -198,41 +199,46 @@ def test_convert_to_intermediate_billing_periods():
70,
69,
],
)

billing_periods = [
NormalizedBillingPeriodRecordInput(
period_start_date=date(2022, 12, 1),
period_end_date=date(2022, 12, 4),
usage=60,
inclusion_override=None,
),
NormalizedBillingPeriodRecordInput(
period_start_date=date(2023, 1, 1),
period_end_date=date(2023, 1, 4),
usage=50,
inclusion_override=None,
),
NormalizedBillingPeriodRecordInput(
period_start_date=date(2023, 2, 1),
period_end_date=date(2023, 2, 4),
usage=45,
inclusion_override=None,
),
NormalizedBillingPeriodRecordInput(
period_start_date=date(2023, 3, 1),
period_end_date=date(2023, 3, 4),
usage=30,
inclusion_override=None,
),
NormalizedBillingPeriodRecordInput(
period_start_date=date(2023, 4, 1),
period_end_date=date(2023, 4, 4),
usage=0.96,
inclusion_override=None,
),
}

temperature_input = TemperatureInput(**temperature_dict)

billing_periods_dict = [
{
'period_start_date':'2022-12-01',
'period_end_date':'2022-12-04',
'usage':60,
'inclusion_override':None,
},
{
'period_start_date':'2023-01-01',
'period_end_date':'2023-01-04',
'usage':50,
'inclusion_override':None,
},
{
'period_start_date':'2023-02-01',
'period_end_date':'2023-02-04',
'usage':45,
'inclusion_override':None,
},
{
'period_start_date':'2023-03-01',
'period_end_date':'2023-03-04',
'usage':30,
'inclusion_override':None,
},
{
'period_start_date':'2023-04-01',
'period_end_date':'2023-04-04',
'usage':0.96,
'inclusion_override':None,
},
]

billing_periods = [NormalizedBillingPeriodRecordInput(**x) for x in billing_periods_dict]

results = engine.convert_to_intermediate_billing_periods(
temperature_input, billing_periods
)
Expand Down

0 comments on commit 7a88184

Please sign in to comment.