Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / internet / test / test_main.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Tests for L{twisted.internet.main}.
6 """
7
8 from twisted.trial import unittest
9 from twisted.internet.error import ReactorAlreadyInstalledError
10 from twisted.internet.main import installReactor
11
12
13 class InstallReactorTests(unittest.TestCase):
14     """
15     Tests for L{installReactor}
16     """
17
18     def test_alreadyInstalled(self):
19         """
20         If a reactor is already installed, L{installReactor} raises
21         L{ReactorAlreadyInstalledError}.
22         """
23         # Because this test runs in trial, assume a reactor is already
24         # installed.
25         self.assertRaises(ReactorAlreadyInstalledError, installReactor,
26                           object())
27
28
29     def test_errorIsAnAssertionError(self):
30         """
31         For backwards compatibility, L{ReactorAlreadyInstalledError} is an
32         L{AssertionError}.
33         """
34         self.assertTrue(issubclass(ReactorAlreadyInstalledError,
35                         AssertionError))
36
37
38