Javi Merino | 7f3c8a6 | 2014-06-13 11:38:58 +0100 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import unittest |
| 4 | |
Javi Merino | 6a5c88d | 2014-06-19 09:43:18 +0100 | [diff] [blame] | 5 | from test_thermal import TestThermalBase |
| 6 | import cr2 |
Javi Merino | 7f3c8a6 | 2014-06-13 11:38:58 +0100 | [diff] [blame] | 7 | import plot_utils |
| 8 | |
| 9 | class 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 Merino | 3a73655 | 2014-06-19 19:22:44 +0100 | [diff] [blame] | 21 | |
| 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 Merino | f9d43af | 2014-06-21 16:32:04 +0100 | [diff] [blame] | 30 | plot_utils.post_plot_setup(ax, xlabel="Bar") |
Javi Merino | d04643f | 2014-06-21 17:00:16 +0100 | [diff] [blame^] | 31 | plot_utils.post_plot_setup(ax, xlim=(0, 100)) |
Javi Merino | 6a5c88d | 2014-06-19 09:43:18 +0100 | [diff] [blame] | 32 | |
| 33 | class TestPlotUtilsNeedTrace(TestThermalBase): |
| 34 | def test_plot_allfreqs(self): |
| 35 | """Test that plot_allfreqs() doesn't bomb""" |
| 36 | |
| 37 | inp = cr2.InPower() |
| 38 | outp = cr2.OutPower() |
| 39 | map_label = {"0000000f": "A7", "000000f0": "A15"} |
| 40 | |
| 41 | plot_utils.plot_allfreqs(inp, outp, map_label) |