bt2: add `if __name__ == '__main__'` snippet to all tests
[babeltrace.git] / tests / bindings / python / bt2 / test_interrupter.py
CommitLineData
1e920353
PP
1#
2# Copyright (C) 2019 EfficiOS Inc.
3#
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
7# of the License.
8#
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.
13#
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.
17#
18
19import bt2
20import unittest
21
22
23class InterrupterTestCase(unittest.TestCase):
24 def setUp(self):
25 self._interrupter = bt2.Interrupter()
26
27 def test_create(self):
28 self.assertFalse(self._interrupter.is_set)
29
30 def test_is_set(self):
31 self.assertFalse(self._interrupter.is_set)
32
33 def test_bool(self):
34 self.assertFalse(self._interrupter)
35 self._interrupter.set()
36 self.assertTrue(self._interrupter)
37
38 def test_set(self):
39 self.assertFalse(self._interrupter)
40 self._interrupter.set()
41 self.assertTrue(self._interrupter)
42
43 def test_reset(self):
44 self._interrupter.set()
45 self.assertTrue(self._interrupter)
46 self._interrupter.reset()
47 self.assertFalse(self._interrupter)
d14ddbba
SM
48
49
50if __name__ == '__main__':
51 unittest.main()
This page took 0.0276 seconds and 4 git commands to generate.