Ticket #10753: fix.diff

File fix.diff, 1.4 KB (added by Karataev Pavel, 11 years ago)
  • django/dispatch/dispatcher.py

     
    124124            (r_key, _) = self.receivers[index]
    125125            if r_key == lookup_key:
    126126                del self.receivers[index]
     127                break
    127128
    128129    def send(self, sender, **named):
    129130        """Send signal from sender to all connected receivers.
  • tests/regressiontests/dispatch/tests/test_dispatcher.py

     
    102102        self.assertEqual(err.args, ('this',))
    103103        a_signal.disconnect(fails)
    104104        self._testIsClean(a_signal)
     105   
     106    def testDisconnection(self):
     107        receiver_1 = Callable()
     108        receiver_2 = Callable()
     109        receiver_3 = Callable()
    105110
     111        a_signal.connect(receiver_1)
     112        a_signal.connect(receiver_2)
     113        a_signal.connect(receiver_3)
     114
     115        a_signal.disconnect(receiver_1)
     116        del receiver_2
     117        garbage_collect()
     118        a_signal.disconnect(receiver_3)
     119        self._testIsClean(a_signal)
     120
    106121def getSuite():
    107122    return unittest.makeSuite(DispatcherTests,'test')
    108123
Back to Top