-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathraster_label_visualizer_test.py
58 lines (48 loc) · 1.71 KB
/
raster_label_visualizer_test.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
"""Tests for geospatial.visualization.raster_label_visualizer."""
import unittest
from geospatial.visualization.raster_label_visualizer import RasterLabelVisualizer
class TestRasterLabelVisualizer(unittest.TestCase):
def setUp(self):
test_label_map = {
# serialized JSON object has to have str keys
'num_to_name': {
"1": "Urban and infrastructure",
"2": "Agriculture",
"3": "Arboreal and forestry crops",
"4": "Pasture",
"5": "Vegetation",
"6": "Forest",
"7": "Savanna",
"8": "Sand, rocks and bare land",
"9": "Unavailable",
"10": "Swamp",
"11": "Water",
"12": "Seasonal savanna",
"13": "Seasonally flooded savanna",
"0": "Empty of data"
},
'num_to_color': {
"0": "black",
"1": "lightgray",
"2": "pink",
"3": "teal",
"4": "salmon",
"5": "goldenrod",
"6": "darkseagreen",
"7": "gold",
"8": "blanchedalmond",
"9": "whitesmoke",
"10": "darkolivegreen",
"11": "deepskyblue",
"12": "khaki",
"13": "thistle"
}
}
self.visualizer = RasterLabelVisualizer(test_label_map)
def tearDown(self):
pass
def test_uint8_rgb_to_hex(self):
hex_str = RasterLabelVisualizer.uint8_rgb_to_hex(0, 100, 255)
self.assertEqual(hex_str.upper(), '#0064FF')
if __name__ == '__main__':
unittest.main()