def test_dict(self):

        someothertable, sometable = self.tables.someothertable, \
                                            self.tables.sometable


        class Foo(object):
            pass
        class Bar(object):
            pass
        class AppenderDict(dict):
            @collection.appender
            def set(self, item):
                self[id(item)] = item
            @collection.remover
            def remove(self, item):
                if id(item) in self:
                    del self[id(item)]

        mapper(Foo, sometable, properties={
            'bars': relationship(Bar, collection_class=AppenderDict)
        })
        mapper(Bar, someothertable)
        f = Foo()
        f.bars.set(Bar())
        f.bars.set(Bar())
        sess = create_session()
        sess.add(f)
        sess.flush()
        sess.expunge_all()
        f = sess.query(Foo).get(f.col1)
        assert len(list(f.bars)) == 2
        f.bars.clear()
Handle one request, without blocking.
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CustomCollectionsTest.test_dict--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/httplib2/httplib2/test/miniserver.py/ShutdownServer._handle_request_noblock