@@ -223,19 +223,6 @@ class TestPlotOptionLogic(PlotlyTestCase):
223
223
{'world_readable' : True , 'sharing' : 'private' },
224
224
{'world_readable' : False , 'sharing' : 'public' }
225
225
)
226
- opposite_option_set = (
227
- ({'world_readable' : True , 'sharing' : 'public' , 'auto_open' : True },
228
- {'world_readable' : False , 'sharing' : 'secret' , 'auto_open' : False }),
229
-
230
- ({'world_readable' : True , 'sharing' : 'public' , 'auto_open' : False },
231
- {'world_readable' : False , 'sharing' : 'private' , 'auto_open' : True }),
232
-
233
- ({'world_readable' : False , 'sharing' : 'private' , 'auto_open' : True },
234
- {'world_readable' : True , 'sharing' : 'public' , 'auto_open' : False }),
235
-
236
- ({'world_readable' : False , 'sharing' : 'private' , 'auto_open' : False },
237
- {'world_readable' : True , 'sharing' : 'public' , 'auto_open' : True })
238
- )
239
226
240
227
def test_default_options (self ):
241
228
options = py ._plot_option_logic ({})
@@ -263,44 +250,6 @@ def test_set_config_updates_plot_options(self):
263
250
self .assertEqual (new_options [key ], options [key ])
264
251
265
252
266
- def generate_call_signature_arguments_updates_options ():
267
- def gen_test (config_plot_options , user_plot_options ):
268
- tls .set_config_file (** config_plot_options )
269
-
270
- def test (self ):
271
- options = py ._plot_option_logic (user_plot_options )
272
-
273
- for key in user_plot_options :
274
- self .assertEqual (options [key ], user_plot_options [key ])
275
- self .assertNotEqual (options [key ], config_plot_options [key ])
276
- return test
277
-
278
- for i , option_sets in enumerate (TestPlotOptionLogic .opposite_option_set ):
279
- setattr (TestPlotOptionLogic ,
280
- 'test_call_signature_arguments_updates_options{}' .format (i ),
281
- gen_test (option_sets [0 ], option_sets [1 ]))
282
- generate_call_signature_arguments_updates_options ()
283
-
284
-
285
- def generate_call_signature_overrides_signin_and_config_file ():
286
- def gen_test (signin_plot_options , user_plot_options ):
287
- py .sign_in ('username' , 'key' , ** signin_plot_options )
288
-
289
- def test (self ):
290
- options = py ._plot_option_logic (user_plot_options )
291
-
292
- for key in user_plot_options :
293
- self .assertEqual (options [key ], user_plot_options [key ])
294
- self .assertNotEqual (options [key ], signin_plot_options [key ])
295
- return test
296
-
297
- for i , option_sets in enumerate (TestPlotOptionLogic .opposite_option_set ):
298
- setattr (TestPlotOptionLogic ,
299
- 'test_call_signature_overrides_signin_and_config_file{}' .format (i ),
300
- gen_test (option_sets [0 ], option_sets [1 ]))
301
- generate_call_signature_overrides_signin_and_config_file ()
302
-
303
-
304
253
def generate_conflicting_plot_options_in_signin ():
305
254
"""sign_in overrides the default plot options.
306
255
conflicting options aren't raised until plot or iplot is called,
@@ -370,22 +319,25 @@ def generate_private_sharing_and_public_world_readable_precedence():
370
319
"""
371
320
plot_option_sets = (
372
321
{
373
- 'parent' : {'world_readable' : True },
374
- 'child' : {'sharing' : 'secret' },
322
+ 'parent' : {'world_readable' : True , 'auto_open' : False },
323
+ 'child' : {'sharing' : 'secret' , 'auto_open' : True },
375
324
'expected_output' : {'world_readable' : False ,
376
- 'sharing' : 'secret' }
325
+ 'sharing' : 'secret' ,
326
+ 'auto_open' : True }
377
327
},
378
328
{
379
- 'parent' : {'world_readable' : True },
380
- 'child' : {'sharing' : 'private' },
329
+ 'parent' : {'world_readable' : True , 'auto_open' : True },
330
+ 'child' : {'sharing' : 'private' , 'auto_open' : False },
381
331
'expected_output' : {'world_readable' : False ,
382
- 'sharing' : 'private' }
332
+ 'sharing' : 'private' ,
333
+ 'auto_open' : False }
383
334
},
384
335
{
385
- 'parent' : {'world_readable' : False },
386
- 'child' : {'sharing' : 'public' },
336
+ 'parent' : {'world_readable' : False , 'auto_open' : False },
337
+ 'child' : {'sharing' : 'public' , 'auto_open' : True },
387
338
'expected_output' : {'world_readable' : True ,
388
- 'sharing' : 'public' }
339
+ 'sharing' : 'public' ,
340
+ 'auto_open' : True }
389
341
}
390
342
)
391
343
@@ -397,10 +349,22 @@ def test(self):
397
349
self .assertEqual (options [option ], value )
398
350
return test
399
351
352
+ def gen_test_config (plot_options ):
353
+ def test (self ):
354
+ tls .set_config (** plot_options ['parent' ])
355
+ options = py ._plot_option_logic (plot_options ['child' ])
356
+ for option , value in plot_options ['expected_output' ].iteritems ():
357
+ self .assertEqual (options [option ], value )
358
+
400
359
for i , plot_options in enumerate (plot_option_sets ):
401
360
setattr (TestPlotOptionLogic ,
402
361
'test_private_sharing_and_public_'
403
- 'world_readable_precedence {}' .format (i ),
362
+ 'world_readable_precedence_signin {}' .format (i ),
404
363
gen_test_signin (plot_options ))
405
364
365
+ setattr (TestPlotOptionLogic ,
366
+ 'test_private_sharing_and_public_'
367
+ 'world_readable_precedence_config{}' .format (i ),
368
+ gen_test_config (plot_options ))
369
+
406
370
generate_private_sharing_and_public_world_readable_precedence ()
0 commit comments