Skip to content
Snippets Groups Projects
Commit 08cd71d2 authored by Lan Dam's avatar Lan Dam
Browse files

unittest

parent 318d1e6a
No related branches found
No related tags found
1 merge request!175correct the way to identify colors for mass pos
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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment