2 # Copyright (C) 2019 EfficiOS Inc.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; only version 2
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 class MipTestCase(unittest
.TestCase
):
25 def test_get_greatest_operative_mip_version(self
):
27 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
30 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
34 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
37 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
41 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
46 bt2
.ComponentDescriptor(Source1
),
47 bt2
.ComponentDescriptor(Source2
),
48 bt2
.ComponentDescriptor(Source3
),
50 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
51 self
.assertEqual(version
, 0)
53 def test_get_greatest_operative_mip_version_no_match(self
):
55 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
58 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
62 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
65 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
69 bt2
.ComponentDescriptor(Source1
),
70 bt2
.ComponentDescriptor(Source2
),
73 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
74 self
.assertIsNone(version
)
76 def test_get_greatest_operative_mip_version_empty_descriptors(self
):
77 with self
.assertRaises(ValueError):
78 bt2
.get_greatest_operative_mip_version([])
80 def test_get_greatest_operative_mip_version_wrong_descriptor_type(self
):
82 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
85 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
88 descriptors
= [bt2
.ComponentDescriptor(Source1
), object()]
90 with self
.assertRaises(TypeError):
91 bt2
.get_greatest_operative_mip_version(descriptors
)
93 def test_get_greatest_operative_mip_version_wrong_log_level_type(self
):
95 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
99 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
101 with self
.assertRaises(TypeError):
102 bt2
.get_greatest_operative_mip_version(descriptors
, 'lel')
104 def test_get_greatest_operative_mip_version_wrong_log_level_value(self
):
106 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
110 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
112 with self
.assertRaises(ValueError):
113 bt2
.get_greatest_operative_mip_version(descriptors
, 12345)
115 def test_get_maximal_mip_version(self
):
116 self
.assertEqual(bt2
.get_maximal_mip_version(), 0)
This page took 0.035555 seconds and 4 git commands to generate.