TU-Programmieren_2/exercise3/task3.test.py
2025-04-09 10:22:44 +02:00

40 lines
851 B
Python

#!/usr/bin/env python3
""" Task3: tests """
import os
import unittest
import matplotlib.pyplot as plt
import task3
class Test(unittest.TestCase):
def test_plot_sin(self):
figname = "test.task3.sin.png"
if os.path.isfile(figname):
os.remove(figname)
plt.close('all')
task3.plot_discrete_function("test.task3.sin.csv",";","#",figname)
plt.close('all')
self.assertTrue(os.path.isfile(figname))
def test_plot_cos(self):
figname = "test.task3.cos.png"
if os.path.isfile(figname):
os.remove(figname)
plt.close('all')
task3.plot_discrete_function("test.task3.cos.csv",";","#",figname)
plt.close('all')
self.assertTrue(os.path.isfile(figname))
if __name__ == "__main__":
unittest.main()