Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed Jun 14, 2024
1 parent 6e4dbc2 commit d3cd364
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/test_supply_curve_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,17 @@ def test_least_cost_simple_with_reinforcement():
assert not np.allclose(sc_simple[SupplyCurveField.TOTAL_LCOE],
sc_simple_r[SupplyCurveField.TOTAL_LCOE])

check_cols = [SupplyCurveField.POI_LAT,
SupplyCurveField.POI_LON,
SupplyCurveField.REINFORCEMENT_POI_LAT,
SupplyCurveField.REINFORCEMENT_POI_LON,
SupplyCurveField.REINFORCEMENT_COST_PER_MW,
SupplyCurveField.REINFORCEMENT_DIST_KM]
nan_cols = [SupplyCurveField.POI_LAT,
SupplyCurveField.POI_LON,
SupplyCurveField.REINFORCEMENT_POI_LAT,
SupplyCurveField.REINFORCEMENT_POI_LON]
for col in _REQUIRED_OUTPUT_COLS:
for col in check_cols:
assert col in sc_simple
if col in nan_cols:
assert sc_simple[col].isna().all()
Expand All @@ -605,6 +611,15 @@ def test_least_cost_simple_with_reinforcement():
assert col in sc_simple_r
assert (sc_simple_r[col] > 0).all()

assert np.allclose(
sc_simple[SupplyCurveField.TOTAL_TRANS_CAP_COST_PER_MW]
* 0.1
/ sc_simple[SupplyCurveField.MEAN_CF_AC]
/ 8760,
sc_simple[SupplyCurveField.LCOT],
atol=0.001
)


# pylint: disable=no-member
@pytest.mark.parametrize("r_costs", [True, False])
Expand Down Expand Up @@ -641,6 +656,15 @@ def test_least_cost_simple_with_trans_cap_cost_per_mw(r_costs):
sc_simple = pd.read_csv(sc_simple)
assert (sc_simple[SupplyCurveField.TRANS_GID] == 42445).all()

assert np.allclose(
sc_simple[SupplyCurveField.TOTAL_TRANS_CAP_COST_PER_MW]
* 0.1
/ sc_simple[SupplyCurveField.MEAN_CF_AC]
/ 8760,
sc_simple[SupplyCurveField.LCOT],
atol=0.001
)

if not r_costs:
lcot = 4244.5 / (sc_simple[SupplyCurveField.MEAN_CF_AC] * 8760)
assert np.allclose(lcot, sc_simple[SupplyCurveField.LCOT],
Expand Down

0 comments on commit d3cd364

Please sign in to comment.