From 08cd71d25c553e1bd3e896482b6bd3c42a9c42b3 Mon Sep 17 00:00:00 2001
From: ldam <ldam@passcal.nmt.edu>
Date: Thu, 14 Sep 2023 11:58:55 -0600
Subject: [PATCH] unittest

---
 .../plotting_widget/test_plotting_helper.py   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 tests/view/plotting/plotting_widget/test_plotting_helper.py

diff --git a/tests/view/plotting/plotting_widget/test_plotting_helper.py b/tests/view/plotting/plotting_widget/test_plotting_helper.py
new file mode 100644
index 000000000..66570fd7c
--- /dev/null
+++ b/tests/view/plotting/plotting_widget/test_plotting_helper.py
@@ -0,0 +1,26 @@
+from unittest import TestCase
+
+from sohstationviewer.view.plotting.plotting_widget.plotting_helper import (
+    get_colors_sizes_for_abs_y_from_value_colors
+)
+from sohstationviewer.view.util.color import clr
+
+
+class TestGetColorsSizesForAbsYFromValueColors(TestCase):
+    def test_get_colors_sizes_for_abs_y_from_value_colors(self):
+        y = [0, 0.5, 1., 2., 3., 4., 5., 7., 7.1,
+             -0, -0.5, -1., -2., -3., -4., -5., -7., -7.1]
+        value_colors = [(0.5, 'C'), (2.0, 'G'), (4.0, 'Y'),
+                        (7.0, 'R'), (7.0, 'M')]
+        colors, sizes = get_colors_sizes_for_abs_y_from_value_colors(
+            y, value_colors)
+
+        self.assertEqual(
+            colors,
+            [clr['C'], clr['C'], clr['G'], clr['G'], clr['Y'], clr['Y'],
+             clr['R'], clr['R'], clr['M'],
+             clr['C'], clr['C'], clr['G'], clr['G'], clr['Y'], clr['Y'],
+             clr['R'], clr['R'], clr['M']
+             ]
+        )
+        self.assertEqual(sizes, [1.5] * len(y))
-- 
GitLab