Skip to content

Commit

Permalink
Add test for Widget.close_all()
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Mar 26, 2021
1 parent edcfa43 commit 8f946fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ipywidgets/widgets/tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ def test_widget_view():
assert 'application/vnd.jupyter.widget-view+json' in mime_bundle, "widget should have have a view"
assert cap.stdout == '', repr(cap.stdout)
assert cap.stderr == '', repr(cap.stderr)


def test_close_all():
# create a couple of widgets
widgets = [Button() for i in range(10)]

# close all the widgets
Widget.close_all()

assert len(Widget._active_widgets) == 0, "active widgets should be cleared"

0 comments on commit 8f946fa

Please sign in to comment.