示例#1
0
 def test_pickle_mpl_bokeh(self):
     """
     Test pickle saving and loading with Store (style information preserved)
     """
     fname = 'test_pickle_mpl_bokeh.pkl'
     raw = super(TestCrossBackendOptionPickling, self).test_mpl_bokeh_mpl()
     Store.dump(raw, open(fname, 'wb'))
     self.clear_options()
     img = Store.load(open(fname, 'rb'))
     # Data should match
     self.assertEqual(raw, img)
     # 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'})
示例#2
0
 def test_pickle_mpl_bokeh(self):
     """
     Test pickle saving and loading with Store (style information preserved)
     """
     fname = 'test_pickle_mpl_bokeh.pkl'
     raw = super(TestCrossBackendOptionPickling, self).test_mpl_bokeh_mpl()
     Store.dump(raw, open(fname,'wb'))
     self.clear_options()
     img = Store.load(open(fname,'rb'))
     # Data should match
     self.assertEqual(raw, img)
     # 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'})