Skip to content

Commit ed11bd3

Browse files
committed
add simple unit test that checks that the polar plot works
1 parent c26724c commit ed11bd3

4 files changed

Lines changed: 8781 additions & 8767 deletions

File tree

Python_Engine/Python/src/python_toolkit/plot/polar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def polar(
4646
The number of directions to use. Defaults to 36.
4747
value_bins (list[float]):
4848
The bins to use for the magnitudes of the values.
49-
colors: (str | tuple[float] | Colormap, optional):
50-
A list of colors to use for the value_bins. May also be a colormap.
49+
colours: (str | tuple[float] | Colormap, optional):
50+
A list of colours to use for the value_bins. May also be a matplotlib colormap.
5151
title (str, optional):
5252
title to display above the plot. Defaults to the source of this wind object.
5353
legend (bool, optional):
@@ -57,7 +57,7 @@ def polar(
5757
label (bool, optional):
5858
Set to False to remove the bin labels. Defaults to False.
5959
density (bool, optional):
60-
Set to False to see the sum of the values instead of their frequency density
60+
Set to False to see the sum of the values instead of their frequency density. Defaults to True.
6161
Returns:
6262
plt.Axes: The axes object.
6363
"""

Python_Engine/Python/tests/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ def get_timeseries():
1111
df = df.set_index(pd.to_datetime(df.index))
1212
return pd.Series(df["Value"], index=df.index)
1313

14-
TIMESERIES_COLLECTION = get_timeseries()
14+
def get_test_data():
15+
df = pd.read_csv(Path(__file__).parent / "assets" / "example_timeseries.csv", index_col="Timestamp")
16+
df = df.set_index(pd.to_datetime(df.index))
17+
return df
18+
19+
TEST_DATA = get_test_data()
20+
TIMESERIES_COLLECTION = pd.Series(TEST_DATA["Value"], index=TEST_DATA.index)
1521

1622
#use 'agg' for testing plot methods, as tkinter occasionally throws strange errors (missing component/library when component isn't missing) when the default backend is used only when using pytest
1723
mpl.use("agg")

0 commit comments

Comments
 (0)