Skip to content

Commit cf0346d

Browse files
authored
Merge pull request #2 from AdamFinkle/add_greenbutton
Ran linter and corrected typing.
2 parents a52ebab + 999aab3 commit cf0346d

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

rules-engine/src/rules_engine/parser.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
NaturalGasBillingInput,
1414
NaturalGasBillingRecordInput,
1515
ElectricBillingInput,
16-
ElectricBillingRecordInput
16+
ElectricBillingRecordInput,
1717
)
1818

1919

@@ -209,7 +209,7 @@ def _parse_gas_bill_xml(path: str) -> NaturalGasBillingInput:
209209
return NaturalGasBillingInput(records=records)
210210

211211

212-
def _parse_electric_bill_xml(path: str) -> NaturalGasBillingInput:
212+
def _parse_electric_bill_xml(path: str) -> ElectricBillingInput:
213213
"""
214214
Return a list of gas bill data parsed from a Green Button XML
215215
received as a string.
@@ -230,4 +230,4 @@ def _parse_electric_bill_xml(path: str) -> NaturalGasBillingInput:
230230
)
231231
)
232232

233-
return ElectricBillingInput(records=records)
233+
return ElectricBillingInput(records=records)

rules-engine/tests/test_rules_engine/test_parser.py

+20-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from rules_engine import parser
77
from rules_engine.pydantic_models import (
88
NaturalGasBillingRecordInput,
9-
ElectricBillingRecordInput
9+
ElectricBillingRecordInput,
1010
)
1111

1212
ROOT_DIR = pathlib.Path(__file__).parent / "cases" / "examples"
@@ -29,22 +29,26 @@ def _read_gas_bill_national_grid() -> str:
2929

3030
def _get_gas_bill_xml_path() -> pathlib.Path:
3131
"""Return the path of a test natural gas XML bill"""
32-
return (pathlib.Path(__file__).parent
33-
/ "cases"
34-
/ "parsing"
35-
/ "xml"
36-
/ "natural_gas"
37-
/ "ngma_natural_gas_billing_billing_data_Service 1_1_2021-05-26_to_2024-04-25.xml")
32+
return (
33+
pathlib.Path(__file__).parent
34+
/ "cases"
35+
/ "parsing"
36+
/ "xml"
37+
/ "natural_gas"
38+
/ "ngma_natural_gas_billing_billing_data_Service 1_1_2021-05-26_to_2024-04-25.xml"
39+
)
3840

3941

4042
def _get_electric_bill_xml_path() -> pathlib.Path:
4143
"""Return the path of a test natural gas XML bill"""
42-
return (pathlib.Path(__file__).parent
43-
/ "cases"
44-
/ "parsing"
45-
/ "xml"
46-
/ "electricicity"
47-
/ "TestGBDataHourlyNineDaysBinnedDaily.xml")
44+
return (
45+
pathlib.Path(__file__).parent
46+
/ "cases"
47+
/ "parsing"
48+
/ "xml"
49+
/ "electricicity"
50+
/ "TestGBDataHourlyNineDaysBinnedDaily.xml"
51+
)
4852

4953

5054
def _validate_eversource(result):
@@ -141,14 +145,14 @@ def test_parse_gas_bill_national_grid():
141145

142146
def test_parse_gas_bill_xml():
143147
"""Tests parsing a natural gas bill from a Green Button XML."""
144-
_validate_gas_bill_xml(
145-
parser._parse_gas_bill_xml(_get_gas_bill_xml_path()))
148+
_validate_gas_bill_xml(parser._parse_gas_bill_xml(_get_gas_bill_xml_path()))
146149

147150

148151
def test_parse_electric_bill_xml():
149152
"""Tests parsing an electricicity bill from a Green Button XML."""
150153
_validate_electric_bill_xml(
151-
parser._parse_electric_bill_xml(_get_electric_bill_xml_path()))
154+
parser._parse_electric_bill_xml(_get_electric_bill_xml_path())
155+
)
152156

153157

154158
def test_detect_natural_gas_company():

rules-engine/tests/test_rules_engine/test_pydantic_models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
NaturalGasBillingInput,
77
NaturalGasBillingRecordInput,
88
ElectricBillingInput,
9-
ElectricBillingRecordInput
9+
ElectricBillingRecordInput,
1010
)
1111

1212
_EXAMPLE_VALID_RECORDS_NATURAL_GAS = NaturalGasBillingInput(

0 commit comments

Comments
 (0)