From 08da33df6421e1c46bc2eb1a802a3d5bddaca357 Mon Sep 17 00:00:00 2001 From: AdamFinkle <77808710+AdamFinkle@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:40:52 -0400 Subject: [PATCH 1/2] Changed test to use datetime. --- heat-stack/app/utils/pyodide.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heat-stack/app/utils/pyodide.test.ts b/heat-stack/app/utils/pyodide.test.ts index 1dff3364..159afe45 100644 --- a/heat-stack/app/utils/pyodide.test.ts +++ b/heat-stack/app/utils/pyodide.test.ts @@ -220,6 +220,7 @@ test('pyodide solves climate change', async () => { } const executePy = await pyodide.runPythonAsync(` + from datetime import date from rules_engine import parser from rules_engine.pydantic_models import ( FuelType, @@ -237,7 +238,7 @@ test('pyodide solves climate change', async () => { summaryInput = SummaryInput(**summaryInputFromJs) - temperatureInput = TemperatureInput(**temperatureInputFromJs) + temperatureInput = TemperatureInput(dates=[date.fromisoformat(date) for date in temperatureInputFromJs["dates"]], temperatures=temperatureInputFromJs["temperatures"]) outputs = engine.get_outputs_natural_gas(summaryInput,temperatureInput, naturalGasInputRecords) From ef2c183321ac1c6dd8f854cb6d38e260f8c268d3 Mon Sep 17 00:00:00 2001 From: AdamFinkle <77808710+AdamFinkle@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:44:42 -0400 Subject: [PATCH 2/2] Changed variable name. --- heat-stack/app/utils/pyodide.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heat-stack/app/utils/pyodide.test.ts b/heat-stack/app/utils/pyodide.test.ts index 159afe45..16e7cd17 100644 --- a/heat-stack/app/utils/pyodide.test.ts +++ b/heat-stack/app/utils/pyodide.test.ts @@ -238,7 +238,7 @@ test('pyodide solves climate change', async () => { summaryInput = SummaryInput(**summaryInputFromJs) - temperatureInput = TemperatureInput(dates=[date.fromisoformat(date) for date in temperatureInputFromJs["dates"]], temperatures=temperatureInputFromJs["temperatures"]) + temperatureInput = TemperatureInput(dates=[date.fromisoformat(date_) for date_ in temperatureInputFromJs["dates"]], temperatures=temperatureInputFromJs["temperatures"]) outputs = engine.get_outputs_natural_gas(summaryInput,temperatureInput, naturalGasInputRecords)