def test_init_styles_nomarkers(self): plotters.init_matplotlib('test.svg', False, False) self.assertEqual(len(plotters.STYLES), len(plotters.LINESTYLES)+\ len(plotters.DASHES)) for ls in plotters.LINESTYLES: self.assertIn(dict(linestyle=ls), plotters.STYLES) for d in plotters.DASHES: self.assertIn(dict(dashes=d), plotters.STYLES)
def __init__(self, settings): Formatter.__init__(self, settings) plotters.init_matplotlib(settings.OUTPUT, settings.USE_MARKERS, settings.LOAD_MATPLOTLIBRC) self.plotters = plotters self.figure = None self.plotter = None
def test_init_styles_nomarkers(self): plotters.init_matplotlib('test.svg', False, False) self.assertEqual(len(plotters.STYLES), len(plotters.LINESTYLES) + len(plotters.DASHES)) for ls in plotters.LINESTYLES: self.assertIn(dict(linestyle=ls), plotters.STYLES) for d in plotters.DASHES: self.assertIn(dict(dashes=d), plotters.STYLES)
def test_init_styles(self): plotters.init_matplotlib('test.svg', True, False) self.assertEqual(len(plotters.STYLES), len(plotters.LINESTYLES) + len(plotters.DASHES) + len(plotters.MARKERS)) for ls in plotters.LINESTYLES: self.assertIn(dict(linestyle=ls), plotters.STYLES) for d in plotters.DASHES: self.assertIn(dict(dashes=d), plotters.STYLES) for m in plotters.MARKERS: self.assertIn(dict(marker=m, markevery=10), plotters.STYLES)
def test_create_ellipsis(self): plotters.init_matplotlib('test.svg', True, True) # Ellipsis plots only work with >=2 data series p = plotters.EllipsisPlotter(self.plot_config, self.data_config) self.assertRaises(RuntimeError, p.init) self.plot_config['series'].append({'data': 'Test 1'}) p = plotters.EllipsisPlotter(self.plot_config, self.data_config) p.init() self.assertIsInstance(p, plotters.EllipsisPlotter)
def runTest(self): pool = Pool(initializer=initfunc) results = resultset.load(self.filename) self.settings.update(results.meta()) self.settings.load_test(informational=True) plotters.init_matplotlib("-", False, True) for p in self.settings.PLOTS.keys(): plot = pool.apply(plot_one, (self.settings, p, results)) if not plot.verify() and p not in PLOTS_MAY_FAIL: raise self.failureException( "Verification of plot '%s' failed" % p)
def test_init_rcfile(self): with mock.patch.object(plotters.matplotlib, 'matplotlib_fname') as mock_obj: mock_obj.return_value = '' if 'MATPLOTLIBRC' in os.environ: del os.environ['MATPLOTLIBRC'] plotters.init_matplotlib('test.svg', False, True) for k,v in MATPLOTLIB_RC_VALUES.items(): self.assertEqual(v, plotters.matplotlib.rcParams[k], msg='rc param mismatch on %s: %s != %s' %(k,v,plotters.matplotlib.rcParams[k])) self.assertEqual(plotters.matplotlib.rcParams['axes.color_cycle'], plotters.COLOURS)
def test_init_rcfile(self): with mock.patch.object(plotters.matplotlib, 'matplotlib_fname') as mock_obj: mock_obj.return_value = '' if 'MATPLOTLIBRC' in os.environ: del os.environ['MATPLOTLIBRC'] plotters.init_matplotlib('test.svg', False, True) for k, v in MATPLOTLIB_RC_VALUES.items(): self.assertEqual(v, plotters.matplotlib.rcParams[k], msg='rc param mismatch on %s: %s != %s' % (k, v, plotters.matplotlib.rcParams[k])) self.assertEqual(plotters.matplotlib.rcParams['axes.color_cycle'], plotters.COLOURS)
def test_create_bar(self): plotters.init_matplotlib('test.svg', True, True) self.create_plotter(plotters.BarPlotter)
def test_create_timeseries_combine(self): plotters.init_matplotlib('test.svg', True, True) self.create_plotter(plotters.TimeseriesCombinePlotter)
def initfunc(): plotters.init_matplotlib("-", False, True)
def plot_one(settings, plot, results): from flent import plotters plotters.init_matplotlib("-", False, True) settings.PLOT = plot return plotters.draw_worker(settings, [results])
def test_create_cdf_combine(self): plotters.init_matplotlib('test.svg', True, True) self.create_plotter(plotters.CdfCombinePlotter)
def test_create_cdf(self): plotters.init_matplotlib('test.svg', True, True) self.create_plotter(plotters.CdfPlotter)
def test_create_subplot_combine(self): plotters.init_matplotlib('test.svg', True, True) self.create_plotter(plotters.SubplotCombinePlotter)
def init_test_backend(self, filename): plotters.init_matplotlib(filename, False, False) return plotters.matplotlib.get_backend()