![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/_threads/test/ |
# 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): """ L{Quit.isSet} starts as L{False}. """ quit = Quit() self.assertEqual(quit.isSet, False) def test_setSetsSet(self): """ L{Quit.set} sets L{Quit.isSet} to L{True}. """ quit = Quit() quit.set() self.assertEqual(quit.isSet, True) def test_checkDoesNothing(self): """ L{Quit.check} initially does nothing and returns L{None}. """ quit = Quit() self.assertIs(quit.check(), None) def test_checkAfterSetRaises(self): """ 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): """ L{Quit.set} raises L{AlreadyQuit} if it has been called previously. """ quit = Quit() quit.set() self.assertRaises(AlreadyQuit, quit.set)