Server IP : 15.235.198.142 / Your IP : 216.73.216.190 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/twisted/_threads/test/ |
Upload File : |
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Test cases for convenience functionality in L{twisted._threads._convenience}. """ from twisted.trial.unittest import SynchronousTestCase from .._convenience import Quit from .._ithreads import AlreadyQuit class QuitTests(SynchronousTestCase): """ Tests for L{Quit} """ def test_isInitiallySet(self) -> None: """ L{Quit.isSet} starts as L{False}. """ quit = Quit() self.assertEqual(quit.isSet, False) def test_setSetsSet(self) -> None: """ L{Quit.set} sets L{Quit.isSet} to L{True}. """ quit = Quit() quit.set() self.assertEqual(quit.isSet, True) def test_checkDoesNothing(self) -> None: """ L{Quit.check} initially does nothing and returns L{None}. """ quit = Quit() self.assertIs(quit.check(), None) def test_checkAfterSetRaises(self) -> None: """ L{Quit.check} raises L{AlreadyQuit} if L{Quit.set} has been called. """ quit = Quit() quit.set() self.assertRaises(AlreadyQuit, quit.check) def test_setTwiceRaises(self) -> None: """ L{Quit.set} raises L{AlreadyQuit} if it has been called previously. """ quit = Quit() quit.set() self.assertRaises(AlreadyQuit, quit.set)