-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_config.py
58 lines (45 loc) · 1.81 KB
/
test_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import unittest
import run_sedimentdrift
from datetime import datetime
from config_sedimentdrift import MartiniConf
from sedimentdrift import SedimentDrift
import numpy as np
from config_plot import ConfigPlot
from typing import List
import matplotlib.pyplot as plt
import matplotlib
from circle_of_distance import Circle_of_distance
class TestConfigPlot(unittest.TestCase):
def setUp(self):
super(TestConfigPlot, self).setUp()
self.config_plot = ConfigPlot()
def tearDown(self) -> None:
super(TestConfigPlot, self).tearDown()
self.config_plot=None
def test_setup_returns_config_object(self):
self.assertIsNotNone(self.config_plot)
self.assertIsInstance(self.config_plot, ConfigPlot)
def test_setup_returns_map_object(self):
self.assertIsNotNone(self.config_plot.ax)
def test_setup_correct_configured(self):
extent = self.config_plot.get_map_extent()
self.assertIsNotNone(extent)
self.assertIsInstance(extent, List)
self.assertTrue(len(extent)==4)
def test_projection_defined(self):
self.assertIsNotNone(self.config_plot.projection)
def test_color_levels(self):
levels=np.arange(-50, -10, 10)
colors = self.config_plot.level_colormap(levels)
self.assertIsNotNone(colors)
self.assertIsInstance(colors, matplotlib.colors.LinearSegmentedColormap)
def test_init_circle_class(self):
circle_of_distance = Circle_of_distance()
self.assertIsInstance(circle_of_distance, Circle_of_distance)
def test_create_circle(self):
circle_of_distance=Circle_of_distance()
lons,lats=circle_of_distance.create_circle_with_radius(10, 10, 1)
self.assertTrue(len(lons) == 360)
self.assertTrue(len(lats) == 360)
if __name__ == "__main__":
unittest.main()