8000 CheckButtons: added "whats_new" and unit test · dashed/matplotlib@316fdbf · GitHub
[go: up one dir, main page]

Skip to content

Commit 316fdbf

Browse files
committed
CheckButtons: added "whats_new" and unit test
Added a basic unit test for the CheckButtons class to lib/matplotlib/tests/test_widgets.py Also, added a description of the new `get_status` function to `doc/users/whats_new/CheckButtons_widget_get_status.rst`
1 parent 0d81f8b commit 316fdbf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CheckButtons widget get_status function
2+
---------------------------------------
3+
4+
A :func:`get_status` function has been added the the :class:`matplotlib.widgets.CheckButtons` class. This :func:`get_status` function allows user to query the status (True/False) of all of the buttons in the CheckButtons object.

lib/matplotlib/tests/test_widgets.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,15 @@ def test_lasso_selector():
257257
check_lasso_selector()
258258
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
259259
check_lasso_selector(useblit=True, button=1)
260+
261+
@cleanup
262+
def test_CheckButtons():
263+
ax = get_ax()
264+
check = widgets.CheckButtons(ax,('a','b','c'),(True,False,True))
265+
assert check.get_status() == [True,False,True]
266+
check.set_active(0)
267+
assert check.get_status() == [False,False,True]
268+
def clicked_function():
269+
pass
270+
cid = check.on_clicked(clicked_function)
271+
check.disconnect(cid)

0 commit comments

Comments
 (0)
0