Skip to content

Commit

Permalink
Linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed May 29, 2024
1 parent 8b2f060 commit a11bc33
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
4 changes: 3 additions & 1 deletion tests/test_hybrids.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def test_hybridization_profile_output_with_ratio_none():
hwp,
) = h.profiles.values()
h_meta = h.hybrid_meta
h_idx = np.where(h_meta[SupplyCurveField.SC_POINT_GID] == sc_point_gid)[0][0]
h_idx = np.where(
h_meta[SupplyCurveField.SC_POINT_GID] == sc_point_gid
)[0][0]

assert np.allclose(hp[:, h_idx], weighted_solar)
assert np.allclose(hsp[:, h_idx], weighted_solar)
Expand Down
13 changes: 9 additions & 4 deletions tests/test_rep_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def test_weighted_meanoid():
sites = np.arange(100)
rev_summary = pd.DataFrame({SupplyCurveField.GEN_GIDS: sites,
SupplyCurveField.RES_GIDS: sites,
SupplyCurveField.GID_COUNTS: [1] * 50 + [0] * 50})
SupplyCurveField.GID_COUNTS: (
[1] * 50 + [0] * 50
)})
r = RegionRepProfile(GEN_FPATH, rev_summary)
weights = r._get_region_attr(r._rev_summary, SupplyCurveField.GID_COUNTS)

Expand Down Expand Up @@ -161,7 +163,8 @@ def test_sc_points():
SupplyCurveField.RES_GIDS: sites,
'timezone': timezone})

rp = RepProfiles(GEN_FPATH, rev_summary, SupplyCurveField.SC_GID, weight=None)
rp = RepProfiles(GEN_FPATH, rev_summary,
SupplyCurveField.SC_GID, weight=None)
rp.run(max_workers=1)

with Resource(GEN_FPATH) as res:
Expand Down Expand Up @@ -191,8 +194,10 @@ def test_agg_profile():
rp.run(scaled_precision=False, max_workers=1)

for index in rev_summary.index:
gen_gids = json.loads(rev_summary.loc[index, SupplyCurveField.GEN_GIDS])
res_gids = json.loads(rev_summary.loc[index, SupplyCurveField.RES_GIDS])
gen_gids = json.loads(rev_summary.loc[index,
SupplyCurveField.GEN_GIDS])
res_gids = json.loads(rev_summary.loc[index,
SupplyCurveField.RES_GIDS])
weights = np.array(
json.loads(rev_summary.loc[index, SupplyCurveField.GID_COUNTS]))

Expand Down
3 changes: 2 additions & 1 deletion tests/test_supply_curve_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def check_agg(agg_out, baseline_h5):
truth = f[dset]
if dset == 'meta':
truth = truth.set_index('sc_gid')
for c in [SupplyCurveField.SOURCE_GIDS, SupplyCurveField.GID_COUNTS]:
for c in [SupplyCurveField.SOURCE_GIDS,
SupplyCurveField.GID_COUNTS]:
test[c] = test[c].astype(str)

truth = truth.fillna('none')
Expand Down
9 changes: 6 additions & 3 deletions tests/test_supply_curve_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ def test_integrated_sc_simple_friction():
sc_simple = pd.read_csv(sc_simple)
assert SupplyCurveField.MEAN_LCOE_FRICTION in sc_simple
assert SupplyCurveField.TOTAL_LCOE_FRICTION in sc_simple
test = sc_simple[SupplyCurveField.MEAN_LCOE_FRICTION] + sc_simple['lcot']
assert np.allclose(test, sc_simple[SupplyCurveField.TOTAL_LCOE_FRICTION])
test = (sc_simple[SupplyCurveField.MEAN_LCOE_FRICTION]
+ sc_simple['lcot'])
assert np.allclose(test,
sc_simple[SupplyCurveField.TOTAL_LCOE_FRICTION])

fpath_baseline = os.path.join(
TESTDATADIR, "sc_out/sc_simple_out_friction.csv"
Expand Down Expand Up @@ -279,7 +281,8 @@ def test_parallel():
assert_frame_equal(sc_full_parallel, sc_full_serial)


def verify_trans_cap(sc_table, trans_tables, cap_col=SupplyCurveField.CAPACITY):
def verify_trans_cap(sc_table, trans_tables,
cap_col=SupplyCurveField.CAPACITY):
"""
Verify that sc_points are connected to features in the correct capacity
bins
Expand Down
6 changes: 4 additions & 2 deletions tests/test_supply_curve_sc_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ def test_agg_extra_dsets():
for dset in h5_dsets:
assert "mean_{}".format(dset) in summary.columns

check = summary['mean_lcoe_fcr-2012'] == summary[SupplyCurveField.MEAN_LCOE]
check = (summary['mean_lcoe_fcr-2012']
== summary[SupplyCurveField.MEAN_LCOE])
assert not any(check)
check = summary['mean_lcoe_fcr-2013'] == summary[SupplyCurveField.MEAN_LCOE]
check = (summary['mean_lcoe_fcr-2013']
== summary[SupplyCurveField.MEAN_LCOE])
assert not any(check)

avg = (summary['mean_lcoe_fcr-2012'] + summary['mean_lcoe_fcr-2013']) / 2
Expand Down

0 comments on commit a11bc33

Please sign in to comment.