def test_add_plot(self): fig = Figure() name = "test" plt.figure() plt.plot(x, y) fig.add_plot(name) # check if correct latex output is produced self.assertEqual( fig.dumps(), ("\\begin{figure}%\n\\centering%\n\\includegraphics[width=0.8" + "\\textwidth]{Graphs/test.jpg}%\n\\end{figure}"), ) plt.close()
def test_reset(self): fig = Figure() # figure 1 for i in range(1, 3): name = f"test{i}" plt.figure() plt.plot(x, y, label=i) fig.add_plot(name) # check if correct latex output is produced self.assertEqual( fig.dumps(), (f"\\begin{{figure}}%\n\\centering%\n\\includegraphics[width=0.8\\textwidth]" + f"{{Graphs/test{i}.jpg}}%\n\\end{{figure}}"), ) fig.reset(show=False, close=True)