def test_instance_event_listen(self):

        users, addresses = self.tables.users, self.tables.addresses

        canary = []

        class A(object):
            pass

        class B(A):
            pass

        mapper(A, users)
        mapper(B, addresses, inherits=A,
               properties={'address_id': addresses.c.id})

        def init_a(target, args, kwargs):
            canary.append(('init_a', target))

        def init_b(target, args, kwargs):
            canary.append(('init_b', target))

        def init_c(target, args, kwargs):
            canary.append(('init_c', target))

        def init_d(target, args, kwargs):
            canary.append(('init_d', target))

        def init_e(target, args, kwargs):
            canary.append(('init_e', target))

        event.listen(mapper, 'init', init_a)
        event.listen(Mapper, 'init', init_b)
        event.listen(class_mapper(A), 'init', init_c)
        event.listen(A, 'init', init_d)
        event.listen(A, 'init', init_e, propagate=True)

        a = A()
        eq_(canary, [('init_a', a), ('init_b', a),
                     ('init_c', a), ('init_d', a), ('init_e', a)])

        # test propagate flag
        canary[:] = []
        b = B()
        eq_(canary, [('init_a', b), ('init_b', b), ('init_e', b)])
Disable maintenance mode
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_events.py/MapperEventsTest.test_instance_event_listen--crossover with--dataset/ETHPy150Open sahana/eden/static/scripts/tools/fabfile.py/maintenance_off