Exemplo n.º 1
0
    def test_call(self):
        reg = CallbackRegistry()
        fn = Mock()

        reg.register_cb(sentinel.msg, fn)

        reg.cb(sentinel.msg, sentinel.param)

        fn.assert_called_once_with(sentinel.param)
Exemplo n.º 2
0
    def test_shared_registrations(self):
        reg1 = CallbackRegistry()
        fn = Mock()

        reg1.register_cb(sentinel.msg, fn)

        del reg1

        reg2 = CallbackRegistry()
        reg2.cb(sentinel.msg, sentinel.param)

        fn.assert_called_once_with(sentinel.param)