Skip to content

Commit f3c69cd

Browse files
committed
Fix on_change callback tests
1 parent aefae22 commit f3c69cd

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

plotly/tests/test_core/test_figure_messages/test_on_change.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,31 @@ def setUp(self):
2929
def test_raise_if_no_figure(self):
3030
scatt = go.Scatter()
3131
fn = MagicMock()
32-
scatt.on_change(fn, False, 'x')
32+
scatt.on_change(fn, 'x')
3333

3434
@raises(ValueError)
3535
def test_raise_on_frame_hierarchy(self):
3636
fn = MagicMock()
37-
self.figure.frames[0].layout.xaxis.on_change(fn, False, 'range')
37+
self.figure.frames[0].layout.xaxis.on_change(fn, 'range')
3838

3939
@raises(ValueError)
4040
def test_validate_property_path_nested(self):
4141
fn = MagicMock()
42-
self.figure.layout.xaxis.on_change(fn, False, 'bogus')
42+
self.figure.layout.xaxis.on_change(fn, 'bogus')
4343

4444
@raises(ValueError)
4545
def test_validate_property_path_nested(self):
4646
fn = MagicMock()
47-
self.figure.layout.on_change(fn, False, 'xaxis.titlefont.bogus')
47+
self.figure.layout.on_change(fn, 'xaxis.titlefont.bogus')
4848

4949
# Python triggered changes
5050
# ------------------------
5151
def test_single_prop_callback_on_assignment(self):
5252
# Install callbacks on 'x', and 'y' property of first trace
5353
fn_x = MagicMock()
5454
fn_y = MagicMock()
55-
self.figure.data[0].on_change(fn_x, False, 'x')
56-
self.figure.data[0].on_change(fn_y, False, 'y')
55+
self.figure.data[0].on_change(fn_x, 'x')
56+
self.figure.data[0].on_change(fn_y, 'y')
5757

5858
# Setting x and y on second trace does not trigger callback
5959
self.figure.data[1].x = [1, 2, 3]
@@ -74,7 +74,7 @@ def test_single_prop_callback_on_assignment(self):
7474
def test_multi_prop_callback_on_assignment_trace(self):
7575
# Register callback if either 'x' or 'y' changes on first trace
7676
fn = MagicMock()
77-
self.figure.data[0].on_change(fn, False, 'x', 'y')
77+
self.figure.data[0].on_change(fn, 'x', 'y')
7878

7979
# Perform assignment on one of the properties
8080
self.figure.data[0].x = [11, 22, 33]
@@ -89,7 +89,7 @@ def test_multi_prop_callback_on_assignment_layout(self):
8989

9090
# Register callback if either axis range is changed. Both tuple and
9191
# dot syntax are supported for nested properties
92-
self.figure.layout.on_change(fn_range, False,
92+
self.figure.layout.on_change(fn_range,
9393
('xaxis', 'range'),
9494
'yaxis.range')
9595

@@ -102,18 +102,17 @@ def test_multi_prop_callback_on_assignment_layout_nested(self):
102102
fn_layout = MagicMock()
103103

104104
# Register callback on change to family property under titlefont
105-
self.figure.layout.xaxis.titlefont.on_change(fn_titlefont, False,
105+
self.figure.layout.xaxis.titlefont.on_change(fn_titlefont,
106106
'family')
107107

108108
# Register callback on the range and titlefont.family properties
109109
# under xaxis
110110
self.figure.layout.xaxis.on_change(fn_xaxis,
111-
False,
112111
'range',
113112
'titlefont.family')
114113

115114
# Register callback on xaxis object itself
116-
self.figure.layout.on_change(fn_layout, False, 'xaxis')
115+
self.figure.layout.on_change(fn_layout, 'xaxis')
117116

118117
# Assign a new xaxis range and titlefont.family
119118
self.figure.layout.xaxis.titlefont.family = 'courier'
@@ -145,10 +144,10 @@ def test_prop_callback_nested_arrays(self):
145144
fn_layout = MagicMock()
146145

147146
self.figure.layout.updatemenus[2].buttons[1].on_change(
148-
fn_button, False, 'method')
147+
fn_button, 'method')
149148

150149
self.figure.layout.on_change(
151-
fn_layout, False, 'updatemenus[2].buttons[1].method')
150+
fn_layout, 'updatemenus[2].buttons[1].method')
152151

153152
# Update button method
154153
self.figure.layout.updatemenus[2].buttons[1].method = 'restyle'
@@ -162,7 +161,6 @@ def test_prop_callback_nested_arrays(self):
162161
def test_callback_on_update(self):
163162
fn_range = MagicMock()
164163
self.figure.layout.on_change(fn_range,
165-
False,
166164
'xaxis.range',
167165
'yaxis.range')
168166

@@ -174,7 +172,6 @@ def test_callback_on_update(self):
174172
def test_callback_on_update_single_call(self):
175173
fn_range = MagicMock()
176174
self.figure.layout.on_change(fn_range,
177-
False,
178175
'xaxis.range',
179176
'yaxis.range',
180177
'width')
@@ -193,7 +190,6 @@ def test_callback_on_update_single_call(self):
193190
def test_callback_on_batch_update(self):
194191
fn_range = MagicMock()
195192
self.figure.layout.on_change(fn_range,
196-
False,
197193
'xaxis.range',
198194
'yaxis.range',
199195
'width')
@@ -212,7 +208,6 @@ def test_callback_on_batch_update(self):
212208
def test_callback_on_batch_animate(self):
213209
fn_range = MagicMock()
214210
self.figure.layout.on_change(fn_range,
215-
False,
216211
'xaxis.range',
217212
'yaxis.range',
218213
'width')
@@ -231,7 +226,6 @@ def test_callback_on_batch_animate(self):
231226
def test_callback_on_plotly_relayout(self):
232227
fn_range = MagicMock()
233228
self.figure.layout.on_change(fn_range,
234-
False,
235229
'xaxis.range',
236230
'yaxis.range',
237231
'width')
@@ -248,7 +242,7 @@ def test_callback_on_plotly_relayout(self):
248242
def test_callback_on_plotly_restyle(self):
249243
# Register callback if either 'x' or 'y' changes on first trace
250244
fn = MagicMock()
251-
self.figure.data[0].on_change(fn, False, 'x', 'y')
245+
self.figure.data[0].on_change(fn, 'x', 'y')
252246

253247
# Perform assignment on one of pthe properties
254248
self.figure.plotly_restyle({'x': [[11, 22, 33],
@@ -263,7 +257,6 @@ def test_callback_on_plotly_restyle(self):
263257
def test_callback_on_plotly_update(self):
264258
fn_range = MagicMock()
265259
self.figure.layout.on_change(fn_range,
266-
False,
267260
'xaxis.range',
268261
'yaxis.range',
269262
'width')

0 commit comments

Comments
 (0)