From 999aab30fed8731449db0326b2121e687cba1a1e Mon Sep 17 00:00:00 2001 From: AdamFinkle <77808710+AdamFinkle@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:32:14 -0400 Subject: [PATCH] Ran linter and corrected typing. --- rules-engine/src/rules_engine/parser.py | 6 ++-- .../tests/test_rules_engine/test_parser.py | 36 ++++++++++--------- .../test_rules_engine/test_pydantic_models.py | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/rules-engine/src/rules_engine/parser.py b/rules-engine/src/rules_engine/parser.py index 525b6c24..e781febf 100644 --- a/rules-engine/src/rules_engine/parser.py +++ b/rules-engine/src/rules_engine/parser.py @@ -13,7 +13,7 @@ NaturalGasBillingInput, NaturalGasBillingRecordInput, ElectricBillingInput, - ElectricBillingRecordInput + ElectricBillingRecordInput, ) @@ -209,7 +209,7 @@ def _parse_gas_bill_xml(path: str) -> NaturalGasBillingInput: return NaturalGasBillingInput(records=records) -def _parse_electric_bill_xml(path: str) -> NaturalGasBillingInput: +def _parse_electric_bill_xml(path: str) -> ElectricBillingInput: """ Return a list of gas bill data parsed from a Green Button XML received as a string. @@ -230,4 +230,4 @@ def _parse_electric_bill_xml(path: str) -> NaturalGasBillingInput: ) ) - return ElectricBillingInput(records=records) \ No newline at end of file + return ElectricBillingInput(records=records) diff --git a/rules-engine/tests/test_rules_engine/test_parser.py b/rules-engine/tests/test_rules_engine/test_parser.py index 8ea72db5..5c90dc36 100644 --- a/rules-engine/tests/test_rules_engine/test_parser.py +++ b/rules-engine/tests/test_rules_engine/test_parser.py @@ -6,7 +6,7 @@ from rules_engine import parser from rules_engine.pydantic_models import ( NaturalGasBillingRecordInput, - ElectricBillingRecordInput + ElectricBillingRecordInput, ) ROOT_DIR = pathlib.Path(__file__).parent / "cases" / "examples" @@ -29,22 +29,26 @@ def _read_gas_bill_national_grid() -> str: def _get_gas_bill_xml_path() -> pathlib.Path: """Return the path of a test natural gas XML bill""" - return (pathlib.Path(__file__).parent - / "cases" - / "parsing" - / "xml" - / "natural_gas" - / "ngma_natural_gas_billing_billing_data_Service 1_1_2021-05-26_to_2024-04-25.xml") + return ( + pathlib.Path(__file__).parent + / "cases" + / "parsing" + / "xml" + / "natural_gas" + / "ngma_natural_gas_billing_billing_data_Service 1_1_2021-05-26_to_2024-04-25.xml" + ) def _get_electric_bill_xml_path() -> pathlib.Path: """Return the path of a test natural gas XML bill""" - return (pathlib.Path(__file__).parent - / "cases" - / "parsing" - / "xml" - / "electricicity" - / "TestGBDataHourlyNineDaysBinnedDaily.xml") + return ( + pathlib.Path(__file__).parent + / "cases" + / "parsing" + / "xml" + / "electricicity" + / "TestGBDataHourlyNineDaysBinnedDaily.xml" + ) def _validate_eversource(result): @@ -141,14 +145,14 @@ def test_parse_gas_bill_national_grid(): def test_parse_gas_bill_xml(): """Tests parsing a natural gas bill from a Green Button XML.""" - _validate_gas_bill_xml( - parser._parse_gas_bill_xml(_get_gas_bill_xml_path())) + _validate_gas_bill_xml(parser._parse_gas_bill_xml(_get_gas_bill_xml_path())) def test_parse_electric_bill_xml(): """Tests parsing an electricicity bill from a Green Button XML.""" _validate_electric_bill_xml( - parser._parse_electric_bill_xml(_get_electric_bill_xml_path())) + parser._parse_electric_bill_xml(_get_electric_bill_xml_path()) + ) def test_detect_natural_gas_company(): diff --git a/rules-engine/tests/test_rules_engine/test_pydantic_models.py b/rules-engine/tests/test_rules_engine/test_pydantic_models.py index 35108a75..412aa6f8 100644 --- a/rules-engine/tests/test_rules_engine/test_pydantic_models.py +++ b/rules-engine/tests/test_rules_engine/test_pydantic_models.py @@ -6,7 +6,7 @@ NaturalGasBillingInput, NaturalGasBillingRecordInput, ElectricBillingInput, - ElectricBillingRecordInput + ElectricBillingRecordInput, ) _EXAMPLE_VALID_RECORDS_NATURAL_GAS = NaturalGasBillingInput(