Exemple #1
0
 def test_options_record_invalid(self):
     StoreOptions.start_recording_skipped()
     with options_policy(skip_invalid=True, warn_on_skip=False):
         Options('test', allowed_keywords=['kw1'], kw1='value', kw2='val')
     errors = StoreOptions.stop_recording_skipped()
     self.assertEqual(len(errors),1)
     self.assertEqual(errors[0].invalid_keyword,'kw2')
Exemple #2
0
 def test_options_record_invalid(self):
     StoreOptions.start_recording_skipped()
     with options_policy(skip_invalid=True, warn_on_skip=False):
         Options('test', allowed_keywords=['kw1'], kw1='value', kw2='val')
     errors = StoreOptions.stop_recording_skipped()
     self.assertEqual(len(errors), 1)
     self.assertEqual(errors[0].invalid_keyword, 'kw2')
Exemple #3
0
 def test_mpl_bokeh_mpl(self):
     img = Image(np.random.rand(10, 10))
     # Use blue in matplotlib
     Store.current_backend = 'matplotlib'
     StoreOptions.set_options(img, style={'Image': {'cmap': 'Blues'}})
     mpl_opts = Store.lookup_options('matplotlib', img, 'style').options
     self.assertEqual(mpl_opts, {'cmap': 'Blues'})
     # Use purple in bokeh
     Store.current_backend = 'bokeh'
     StoreOptions.set_options(img, style={'Image': {'cmap': 'Purple'}})
     bokeh_opts = Store.lookup_options('bokeh', img, 'style').options
     self.assertEqual(bokeh_opts, {'cmap': 'Purple'})
     # Check it is still blue in matplotlib...
     Store.current_backend = 'matplotlib'
     mpl_opts = Store.lookup_options('matplotlib', img, 'style').options
     self.assertEqual(mpl_opts, {'cmap': 'Blues'})
     # And purple in bokeh..
     Store.current_backend = 'bokeh'
     bokeh_opts = Store.lookup_options('bokeh', img, 'style').options
     self.assertEqual(bokeh_opts, {'cmap': 'Purple'})
     return img
Exemple #4
0
 def test_mpl_bokeh_mpl(self):
     img = Image(np.random.rand(10,10))
     # Use blue in matplotlib
     Store.current_backend = 'matplotlib'
     StoreOptions.set_options(img, style={'Image':{'cmap':'Blues'}})
     mpl_opts = Store.lookup_options('matplotlib', img, 'style').options
     self.assertEqual(mpl_opts, {'cmap':'Blues'})
     # Use purple in bokeh
     Store.current_backend = 'bokeh'
     StoreOptions.set_options(img, style={'Image':{'cmap':'Purple'}})
     bokeh_opts = Store.lookup_options('bokeh', img, 'style').options
     self.assertEqual(bokeh_opts, {'cmap':'Purple'})
     # Check it is still blue in matplotlib...
     Store.current_backend = 'matplotlib'
     mpl_opts = Store.lookup_options('matplotlib', img, 'style').options
     self.assertEqual(mpl_opts, {'cmap':'Blues'})
     # And purple in bokeh..
     Store.current_backend = 'bokeh'
     bokeh_opts = Store.lookup_options('bokeh', img, 'style').options
     self.assertEqual(bokeh_opts, {'cmap':'Purple'})
     return img