blob: e4403fa305d287562e114d0f21bfaa606e88d8f7 [file] [log] [blame]
Javi Merino7f3c8a62014-06-13 11:38:58 +01001#!/usr/bin/python
2
3import unittest
4
Javi Merino6a5c88d2014-06-19 09:43:18 +01005from test_thermal import TestThermalBase
6import cr2
Javi Merino7f3c8a62014-06-13 11:38:58 +01007import plot_utils
8
9class TestPlotUtils(unittest.TestCase):
10 def test_set_plot_size(self):
11 """Test that plot_utils.set_plot_size() doesn't bomb"""
12 plot_utils.set_plot_size(None, None)
13 plot_utils.set_plot_size(height=9, width=None)
14 plot_utils.set_plot_size(height=None, width=9)
15 plot_utils.set_plot_size(3, 9)
16
17 def test_normalize_title(self):
18 """Test normalize_title"""
19 self.assertEquals(plot_utils.normalize_title("Foo", ""), "Foo")
20 self.assertEquals(plot_utils.normalize_title("Foo", "Bar"), "Bar - Foo")
Javi Merino3a736552014-06-19 19:22:44 +010021
22 def test_post_plot_setup(self):
23 """Test that post_plot_setup() doesn't bomb"""
24
25 ax = plot_utils.pre_plot_setup()
26
27 plot_utils.post_plot_setup(ax)
28 plot_utils.post_plot_setup(ax, title="Foo")
29 plot_utils.post_plot_setup(ax, ylim=(0, 72))
Javi Merino6a5c88d2014-06-19 09:43:18 +010030
31class TestPlotUtilsNeedTrace(TestThermalBase):
32 def test_plot_allfreqs(self):
33 """Test that plot_allfreqs() doesn't bomb"""
34
35 inp = cr2.InPower()
36 outp = cr2.OutPower()
37 map_label = {"0000000f": "A7", "000000f0": "A15"}
38
39 plot_utils.plot_allfreqs(inp, outp, map_label)