def test_reruns_just_plot_if_plot_changed(self): import pydataframe def calc(): append('out/calc', 'A') return pydataframe.DataFrame({ "X": list(range(0, 100)), 'Y': list(range(50, 150)) }) def plot(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('X', 'Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'), 'A') self.assertEqual(read('out/plot'), 'B') ppg.new_pipegraph(rc_gen(), quiet=True) def plot2(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('Y', 'X') job = ppg.PlotJob(of, calc, plot2) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'), 'A') self.assertEqual(read('out/plot'), 'BB')
def test_no_rerun_if_ignore_code_changes_and_plot_changes(self): import pydataframe def calc(): append('out/calc', 'A') return pydataframe.DataFrame({"X": list(range(0, 100)), 'Y': list(range(50, 150))}) def plot(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('X','Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'),'A') self.assertEqual(read('out/plot'),'B') ppg.new_pipegraph(rc_gen(), quiet=True) def plot2(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('Y','X') job = ppg.PlotJob(of, calc, plot2) job.ignore_code_changes() ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'),'A') self.assertEqual(read('out/plot'),'B')
def test_reruns_both_if_calc_changed(self): import pydataframe def calc(): append('out/calc', 'A') return pydataframe.DataFrame({"X": list(range(0, 100)), 'Y': list(range(50, 150))}) def plot(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('X','Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'),'A') self.assertEqual(read('out/plot'),'B') ppg.new_pipegraph(rc_gen(), quiet=True) def calc2(): append('out/calc', 'A') x = 5 return pydataframe.DataFrame({"X": list(range(0, 100)), 'Y': list(range(50, 150))}) job = ppg.PlotJob(of, calc2, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'),'AA') self.assertEqual(read('out/plot'),'BB')
def test_basic(self): ppg.new_pipegraph(rc_gen(), quiet=False) import pydataframe def calc(): return pydataframe.DataFrame({"X": list(range(0, 100)), 'Y': list(range(50, 150))}) def plot(df): return pyggplot.Plot(df).add_scatter('X','Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1)
def test_basic(self): ppg.new_pipegraph(rc_gen(), quiet=False) import pydataframe def calc(): return pydataframe.DataFrame({ "X": list(range(0, 100)), 'Y': list(range(50, 150)) }) def plot(df): return pyggplot.Plot(df).add_scatter('X', 'Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1)
def test_no_rerun_if_calc_change_but_ignore_codechanges(self): import pydataframe def calc(): append('out/calc', 'A') return pydataframe.DataFrame({ "X": list(range(0, 100)), 'Y': list(range(50, 150)) }) def plot(df): append('out/plot', 'B') return pyggplot.Plot(df).add_scatter('X', 'Y') of = 'out/test.png' job = ppg.PlotJob(of, calc, plot) ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'), 'A') self.assertEqual(read('out/plot'), 'B') ppg.new_pipegraph(rc_gen(), quiet=True) def calc2(): append('out/calc', 'A') x = 5 return pydataframe.DataFrame({ "X": list(range(0, 100)), 'Y': list(range(50, 150)) }) job = ppg.PlotJob(of, calc2, plot) job.ignore_code_changes() ppg.run_pipegraph() self.assertTrue(magic(of).find('PNG image') != -1) self.assertEqual(read('out/calc'), 'A') self.assertEqual(read('out/plot'), 'B')