class SignalTestCaseTest(TestCase): """ Test definitions for the :class:`morris.SignalTestCase` class. """ def setUp(self): self.signal = Signal('signal') self.case = FakeSignalTestCase() def test_watchSignal(self): """ Ensure that calling watchSignal() actually connects a signal listener """ self.assertEqual(len(self.signal.listeners), 0) self.case.watchSignal(self.signal) self.assertEqual(len(self.signal.listeners), 1) def test_assertSignalFired(self): """ Ensure that assertSignalFired works correctly """ self.case.watchSignal(self.signal) self.signal.fire((), {}) sig = self.case.assertSignalFired(self.signal) self.assertEqual(sig, (self.signal, (), {})) def test_assertSignalNotFired(self): """ Ensure that assertSignalNotFired works correctly """ self.case.watchSignal(self.signal) self.case.assertSignalNotFired(self.signal) def test_assertSignalOrdering(self): """ Ensure that assertSignalOrdering works correctly """ self.case.watchSignal(self.signal) self.signal('first') self.signal('second') self.signal('third') first = self.case.assertSignalFired(self.signal, 'first') second = self.case.assertSignalFired(self.signal, 'second') third = self.case.assertSignalFired(self.signal, 'third') self.case.assertSignalOrdering(first, second, third)