def recreate_module(self, pipeline, m_id):
        selected = self.modules[m_id].isSelected()
        depending_connections = \
            [c_id for c_id in self.modules[m_id].dependingConnectionItems()]
        
        # when configuring a python source, maybe connections were deleted
        # but are not in the current pipeline. So we need to check the depending
        # connections of the module just before the configure. 
        for c_id in depending_connections:
            self.remove_connection(c_id)

        self.remove_module(m_id)
        
        self.addModule(pipeline.modules[m_id])
        for c_id in depending_connections:
            # only add back those connections that are in the pipeline
            if c_id in pipeline.connections:
                self.addConnection(pipeline.connections[c_id])
                               
        if selected:
            self.modules[m_id].setSelected(True)
This test will ensure that contains_object works correctly
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/gui/pipeline_view.py/QPipelineScene.recreate_module--crossover with--dataset/ETHPy150Open callowayproject/django-kamasutra/positions/tests.py/PositionsTestCase.testContainsObject