Exemplo n.º 1
0
 def test_cmap_from_json(self):
     """
     Tests creation of a ColorMap from a json file
     """
     json_file = 'Rainbow.json'
     cmap = ColorMap.from_jsonfile(os.path.join(self.data_path, json_file))
     self.assertIsInstance(cmap, ColorMap)
Exemplo n.º 2
0
 def test_save_as_json(self):
     """
     Tests save ColorMap as json file
     """
     cmap = ColorMap('mpl:{}'.format(self.default_mpl_cm))
     cmap.show()
     output_path = os.path.join(self.output_path, 'json_test.json')
     cmap.save_as_json(output_path)
     cmap_read = ColorMap.from_jsonfile(output_path)
     cmap_read.show()
     self.assertIsInstance(cmap_read, ColorMap)