class TPlot(unittest.TestCase): @ddt.data(*co2plot.get_model_paths()) def test_plot_all_models(self, model): dot_graphs = co2plot.plot_model_graphs([model], view_in_browser=False, depth=1) self.assertGreaterEqual(len(dot_graphs), 1, model)
def setUp(self): self.plot_func = co2plot.plot_model_graphs self.odl_dfl = self.plot_func.__defaults__ dfl = list(self.odl_dfl) dfl[1] = False self.plot_func.__defaults__ = tuple(dfl) self.model = co2plot.get_model_paths()[1]
def _cmd_modelgraph(opts): import co2mpas.plot as co2plot if opts['--list']: print('\n'.join(co2plot.get_model_paths())) else: depth = opts['--graph-depth'] if depth: try: depth = int(depth) if depth < 0: depth = None except: msg = "The '--graph-depth' must be an integer! Not %r." raise CmdException(msg % depth) else: depth = None dot_graphs = co2plot.plot_model_graphs(opts['<models>'], depth=depth, output_folder=opts['-O']) if not dot_graphs: raise CmdException("No models plotted!")