1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2019 EfficiOS Inc.
10 class MipTestCase(unittest
.TestCase
):
11 def test_get_greatest_operative_mip_version(self
):
13 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
16 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
20 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
23 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
27 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
32 bt2
.ComponentDescriptor(Source1
),
33 bt2
.ComponentDescriptor(Source2
),
34 bt2
.ComponentDescriptor(Source3
),
36 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
37 self
.assertEqual(version
, 0)
39 def test_get_greatest_operative_mip_version_no_match(self
):
41 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
44 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
48 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
51 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
55 bt2
.ComponentDescriptor(Source1
),
56 bt2
.ComponentDescriptor(Source2
),
59 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
60 self
.assertIsNone(version
)
62 def test_get_greatest_operative_mip_version_empty_descriptors(self
):
63 with self
.assertRaises(ValueError):
64 bt2
.get_greatest_operative_mip_version([])
66 def test_get_greatest_operative_mip_version_wrong_descriptor_type(self
):
68 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
71 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
74 descriptors
= [bt2
.ComponentDescriptor(Source1
), object()]
76 with self
.assertRaises(TypeError):
77 bt2
.get_greatest_operative_mip_version(descriptors
)
79 def test_get_greatest_operative_mip_version_wrong_log_level_type(self
):
81 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
85 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
87 with self
.assertRaises(TypeError):
88 bt2
.get_greatest_operative_mip_version(descriptors
, 'lel')
90 def test_get_greatest_operative_mip_version_wrong_log_level_value(self
):
92 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
96 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
98 with self
.assertRaises(ValueError):
99 bt2
.get_greatest_operative_mip_version(descriptors
, 12345)
101 def test_get_maximal_mip_version(self
):
102 self
.assertEqual(bt2
.get_maximal_mip_version(), 0)
105 if __name__
== '__main__':
This page took 0.031811 seconds and 4 git commands to generate.