+# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2019 EfficiOS Inc.
#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
import bt2
import unittest
tc = get_default_trace_class()
fc = tc.create_signed_enumeration_field_class(32)
- fc.add_mapping('something', bt2.SignedIntegerRangeSet(int_ranges))
+ fc.add_mapping("something", bt2.SignedIntegerRangeSet(int_ranges))
- return create_const_field(tc, fc, range_setter).cls['something'].ranges
+ return create_const_field(tc, fc, range_setter).cls["something"].ranges
def get_const_unsigned_integer_range(int_ranges):
tc = get_default_trace_class()
fc = tc.create_unsigned_enumeration_field_class(32)
- fc.add_mapping('something', bt2.UnsignedIntegerRangeSet(int_ranges))
+ fc.add_mapping("something", bt2.UnsignedIntegerRangeSet(int_ranges))
- return create_const_field(tc, fc, range_setter).cls['something'].ranges
+ return create_const_field(tc, fc, range_setter).cls["something"].ranges
class _IntegerRangeTestCase:
def test_contains_wrong_type(self):
with self.assertRaises(TypeError):
- self._rg.contains('allo')
+ self._rg.contains("allo")
def test_contains_out_of_bound(self):
with self.assertRaises(ValueError):
def test_create_wrong_elem_type(self):
with self.assertRaises(TypeError):
- self._rs = self._CLS((self._range1, self._range2, 'lel'))
+ self._rs = self._CLS((self._range1, self._range2, "lel"))
def test_len(self):
self.assertEqual(len(self._rs), 3)
def test_contains_value_wrong_type(self):
with self.assertRaises(TypeError):
- self._rs.contains_value('meow')
+ self._rs.contains_value("meow")
def test_iter(self):
range_list = list(self._rs)
super().setUp()
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main()