-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added start and end dates to parser output (#197)
* added start and end dates to parser output Co-authored-by: Debajyoti Debnath <[email protected]> Co-authored-by: eriksynn <[email protected]> Co-authored-by: AdamFinkle <[email protected]> Co-authored-by: Jonathan Kwan <[email protected]> Co-authored-by: thatoldplatitude <[email protected]> * added comment tagging mypy issue --------- Co-authored-by: Debajyoti Debnath <[email protected]> Co-authored-by: eriksynn <[email protected]> Co-authored-by: AdamFinkle <[email protected]> Co-authored-by: Jonathan Kwan <[email protected]> Co-authored-by: thatoldplatitude <[email protected]>
- Loading branch information
1 parent
433ef81
commit 0df7f6e
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
rules-engine/tests/test_rules_engine/test_pydantic_models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from datetime import date | ||
|
||
import pytest | ||
|
||
from rules_engine.pydantic_models import ( | ||
NaturalGasBillingInput, | ||
NaturalGasBillingRecordInput, | ||
) | ||
|
||
_EXAMPLE_VALID_RECORDS = NaturalGasBillingInput( | ||
records=[ | ||
NaturalGasBillingRecordInput( | ||
period_start_date=date(2020, 1, 1), | ||
period_end_date=date(2020, 1, 31), | ||
usage_therms=10, | ||
inclusion_override=None, | ||
), | ||
NaturalGasBillingRecordInput( | ||
period_start_date=date(2020, 2, 1), | ||
period_end_date=date(2020, 2, 28), | ||
usage_therms=10, | ||
inclusion_override=None, | ||
), | ||
] | ||
) | ||
|
||
_EXAMPLE_INVALID_RECORDS = NaturalGasBillingInput( | ||
records=[] # create billing input with no records | ||
) | ||
|
||
|
||
def test_natural_gas_billing_input_overall_start_date(): | ||
expected_overall_start_date = date(2020, 1, 1) | ||
actual_overall_start_date = _EXAMPLE_VALID_RECORDS.overall_start_date | ||
|
||
assert expected_overall_start_date == actual_overall_start_date | ||
|
||
|
||
def test_natural_gas_billing_input_overall_end_date(): | ||
expected_overall_end_date = date(2020, 2, 28) | ||
actual_overall_end_date = _EXAMPLE_VALID_RECORDS.overall_end_date | ||
|
||
assert expected_overall_end_date == actual_overall_end_date | ||
|
||
|
||
def test_natural_gas_billing_input_overall_start_date_invalid(): | ||
with pytest.raises(ValueError): | ||
_EXAMPLE_INVALID_RECORDS.overall_start_date | ||
|
||
|
||
def test_natural_gas_billing_input_overall_end_date_invalid(): | ||
with pytest.raises(ValueError): | ||
_EXAMPLE_INVALID_RECORDS.overall_end_date |