Skip to content

Commit 3ca828d

Browse files
author
EnliteAI Bot
committed
RL-2204: Update test and type
(Issue RL-2204 - Improve support for categorical plot)
1 parent ef1cc48 commit 3ca828d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

maze/core/log_events/log_create_figure_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def create_binary_plot(value: Union[List[Tuple[np.ndarray, int]], List[int], Lis
2727

2828

2929
def create_categorical_plot(
30-
value: Union[List[Tuple[int, int]], List[int], List[float], List[np.integer], List[np.floating]], **kwargs
30+
value: Union[List[Tuple[int, int]], List[int], List[float], np.ndarray], **kwargs
3131
) -> plt.Figure:
3232
"""Checks the type of value and calls the correct plotting function accordingly.
3333

maze/test/core/log_events/test_log_create_figure_functions.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,23 @@ def test_create_histogram():
1515

1616

1717
def test_create_categorical_plot():
18-
""" unit test """
18+
""" Test creation of categorical plot with integer, tuples and float. """
19+
20+
# test with integer
1921
values = [int(i) for i in np.random.randint(low=0, high=10, size=100)]
2022
fig = create_categorical_plot(values)
2123
plt.close(fig)
2224

25+
# test with tuples
2326
values = [(v, 10) for v in np.random.randint(low=0, high=10, size=100)]
2427
fig = create_categorical_plot(values)
2528
plt.close(fig)
2629

27-
with raises(NotImplementedError):
28-
values = np.random.random(100)
29-
create_categorical_plot(values)
30+
# test with np.float
31+
values = np.random.random(100)
32+
create_categorical_plot(values)
33+
plt.close(fig)
34+
3035

3136

3237
def test_create_multi_binary_plot():

0 commit comments

Comments
 (0)