Skip to content
Snippets Groups Projects

First OOP implementation of tagplot.py.

Merged Mayr, Hannes requested to merge oop into dev
Files
11
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Unittests for TagPlot
Unittests for tagplot
'''
import unittest
import numpy as np
import matplotlib.pyplot as plt
from TagPlot import TagPlot
from tagplot import tagplot
# %% Create data
@@ -36,37 +36,37 @@ plot_engine = "matplotlib"
method = 1
class TestTagPlot(unittest.TestCase):
class Test_tagplot(unittest.TestCase):
def test_figures(self):
with self.assertRaises(TypeError):
TagPlot('fig', ProjectID, plot_engine, method)
tagplot('fig', ProjectID, plot_engine, method)
with self.assertRaises(TypeError):
TagPlot(fig1, plot_engine, prefix=ProjectID)
tagplot(fig1, plot_engine, prefix=ProjectID)
def test_prefix(self):
with self.assertRaises(TypeError):
TagPlot(fig, plot_engine, 3, method)
tagplot(fig, plot_engine, 3, method)
def test_plotengine(self):
with self.assertRaises(ValueError):
TagPlot(fig, 1, ProjectID, method)
tagplot(fig, 1, ProjectID, method)
with self.assertRaises(ValueError):
TagPlot(fig, 'xyz', ProjectID, method)
tagplot(fig, 'xyz', ProjectID, method)
def test_idmethod(self):
with self.assertRaises(TypeError):
TagPlot(fig, plot_engine, ProjectID, method='(0,1)')
tagplot(fig, plot_engine, ProjectID, method='(0,1)')
with self.assertRaises(TypeError):
TagPlot(fig, plot_engine, ProjectID, method='h')
tagplot(fig, plot_engine, ProjectID, method='h')
with self.assertRaises(TypeError):
TagPlot(fig, plot_engine, ProjectID, method='[0,1]')
tagplot(fig, plot_engine, ProjectID, method='[0,1]')
def test_location(self):
with self.assertRaises(TypeError):
TagPlot(fig, plot_engine, ProjectID, method, location=1)
tagplot(fig, plot_engine, ProjectID, method, location=1)
with self.assertWarns(Warning):
TagPlot(fig, plot_engine, ProjectID, method, location='up')
tagplot(fig, plot_engine, ProjectID, method, location='up')
if __name__ == '__main__':
Loading