(ax)
| 1044 | |
| 1045 | |
| 1046 | def test_CheckButtons(ax): |
| 1047 | labels = ('a', 'b', 'c') |
| 1048 | check = widgets.CheckButtons(ax, labels, (True, False, True)) |
| 1049 | assert check.get_status() == [True, False, True] |
| 1050 | check.set_active(0) |
| 1051 | assert check.get_status() == [False, False, True] |
| 1052 | assert check.get_checked_labels() == ['c'] |
| 1053 | check.clear() |
| 1054 | assert check.get_status() == [False, False, False] |
| 1055 | assert check.get_checked_labels() == [] |
| 1056 | |
| 1057 | for invalid_index in [-1, len(labels), len(labels)+5]: |
| 1058 | with pytest.raises(ValueError): |
| 1059 | check.set_active(index=invalid_index) |
| 1060 | |
| 1061 | for invalid_value in ['invalid', -1]: |
| 1062 | with pytest.raises(TypeError): |
| 1063 | check.set_active(1, state=invalid_value) |
| 1064 | |
| 1065 | cid = check.on_clicked(lambda: None) |
| 1066 | check.disconnect(cid) |
| 1067 | |
| 1068 | |
| 1069 | @pytest.mark.parametrize("toolbar", ["none", "toolbar2", "toolmanager"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…