Belle II Software light-2406-ragdoll
test_entities.py
1
8from unittest import TestCase, main
9
10from hep_ipython_tools.entities import StoreContent, StoreContentList, StatisticsColumn, Statistics
11
12# @cond internal_test
13
14
15class TestStoreContent(TestCase):
16
17 def test_init(self):
18 store_content = StoreContent("Name", 42)
19
20 self.assertEqual(store_content.name, "Name")
21 self.assertEqual(store_content.number, 42)
22
23
24class TestStoreContentList(TestCase):
25
26 def test_init(self):
27 content_list = [StoreContent("First", 1), StoreContent("Second", 2)]
28 store_content_list = StoreContentList(content_list, 21)
29
30 self.assertEqual(store_content_list.content, content_list)
31 self.assertEqual(store_content_list.event_number, 21)
32
33
34class TestStatisticsColumn(TestCase):
35
36 def test_init(self):
37 statistics_column = StatisticsColumn("Name")
38
39 self.assertEqual(statistics_column.name, "Name")
40 self.assertEqual(statistics_column.display_name, "Name")
41 self.assertEqual(statistics_column.three_column_format, False)
42
43 statistics_column = StatisticsColumn("Name", "DisplayName")
44
45 self.assertEqual(statistics_column.name, "Name")
46 self.assertEqual(statistics_column.display_name, "DisplayName")
47 self.assertEqual(statistics_column.three_column_format, False)
48
49 statistics_column = StatisticsColumn("Name", "DisplayName", True)
50
51 self.assertEqual(statistics_column.name, "Name")
52 self.assertEqual(statistics_column.display_name, "DisplayName")
53 self.assertEqual(statistics_column.three_column_format, True)
54
55
56class TestStatistics(TestCase):
57
58 def test_init(self):
59 test_columns = [StatisticsColumn("Name"), StatisticsColumn("OtherName")]
60 test_modules = [1, 2, 3]
61 statistics = Statistics(test_columns, test_modules)
62
63 self.assertEqual(statistics.columns, test_columns)
64 self.assertEqual(statistics.modules, test_modules)
65
66
67if __name__ == "__main__":
68 main()
69# @endcond
Definition: main.py:1