Skip to content

Commit

Permalink
test: fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rouille committed Sep 14, 2022
1 parent b3720cb commit 92fac30
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_plot_bar_generation_max_min_actual():
plot_bar_generation_max_min_actual(
scenario, "Texas", "wind", show_as_state=False, percentage=True, plot_show=False
)
plt.close("all")


def test_plot_bar_generation_max_min_actual_argument_type():
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_bar_generation_stack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import patch

import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -112,6 +113,7 @@ def test_plot_bar_generation_stack(monkeypatch):
curtailment_split=False,
plot_show=False,
)
plt.close("all")


def test_plot_bar_generation_stack_argument_type():
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_bar_generation_vs_capacity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import patch

import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -107,6 +108,7 @@ def test_plot_bar_generation_stack(monkeypatch):
horizontal=True,
plot_show=False,
)
plt.close("all")


def test_plot_bar_generation_stack_argument_type():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -77,6 +78,7 @@ def test_plot_bar_renewable_max_profile_actual():
percentage=True,
plot_show=False,
)
plt.close("all")


def test_plot_bar_renewable_max_profile_actual_argument_type():
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_bar_shortfall.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import patch

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
Expand Down Expand Up @@ -112,6 +113,7 @@ def test_plot_bar_shortfall(monkeypatch):
baseline_scenario_name="Baseline",
plot_show=False,
)
plt.close("all")


def test_plot_bar_shortfall_argument_type():
Expand Down
6 changes: 3 additions & 3 deletions postreise/plot/tests/test_plot_capacity_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
94.7977,
],
"Pmax": [1000, 750, 1500, 300, 500, 300, 200, 800],
"type": ["coal", "ng", "coal", "coal", "wind", "ng", "coal", "solar"],
"type": ["coal", "coal", "coal", "coal", "wind", "coal", "coal", "solar"],
}

scenario = MockScenario({"plant": mock_plant})


def test_map_plant_capacity():
canvas = map_plant_capacity(scenario, ["ng"])
canvas = map_plant_capacity(scenario, ["coal"])
assert isinstance(canvas, plt.Figure)

ct = {
Expand All @@ -49,7 +49,7 @@ def test_map_plant_capacity():
scenario.state.ct = {}
_ = map_plant_capacity(scenario, ["coal"], disaggregation="new_vs_existing_plants")

_ = map_plant_capacity(scenario, ["hydro", "ng"])
_ = map_plant_capacity(scenario, ["hydro", "coal"])


def test_map_plant_capacity_argument_value():
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_carbon_bar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -65,6 +66,7 @@ def test_plot_carbon_bar():
labels=[s1.info["name"], s2.info["name"]],
plot_show=False,
)
plt.close("all")


def test_plot_carbon_bar_argument_type():
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_pie_generation_vs_capacity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import patch

import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -61,6 +62,7 @@ def test_plot_pie_generation_vs_capacity(monkeypatch):
area_types="interconnect",
scenario_ids=[100, 200],
)
plt.close("all")


def _assert_error(err_type, err_msg, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -59,6 +60,7 @@ def test_plot_scatter_capacity_vs_capacity_factor():
title="capacity vs capacity factor for solar in Far West",
plot_show=False,
)
plt.close("all")


def _assert_error(err_msg, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -64,6 +65,7 @@ def test_plot_scatter_capacity_vs_cost_curve_slope():
scenario, "Texas", "solar", plot_show=False
)
assert data_avg == 0
plt.close("all")


def _assert_error(err_msg, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -69,6 +70,7 @@ def test_plot_scatter_capacity_vs_curtailment():
title="capacity vs capacity factor for solar in Far West",
plot_show=False,
)
plt.close("all")


def _assert_error(err_msg, *args, **kwargs):
Expand Down
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_sim_vs_hist.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
Expand Down Expand Up @@ -76,3 +77,4 @@ def test_plot_generation_sim_vs_hist():
scenario, hist_gen, "Texas", show_max=False, plot_show=False
)
plot_generation_sim_vs_hist(scenario, hist_gen, "Texas", plot_show=False)
plt.close("all")
2 changes: 2 additions & 0 deletions postreise/plot/tests/test_plot_tornado.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
import pytest

Expand All @@ -21,6 +22,7 @@

def test_plot_tornado():
plot_tornado("Test data", data, sorted=True, plot_show=False)
plt.close("all")


def _assert_error(err_msg, *args, **kwargs):
Expand Down

0 comments on commit 92fac30

Please sign in to comment.