

def test_tvtk_scene_garbage_collected(self):
    scene_collected = []
    scene_weakref = None

    def scene_collected_callback(weakref):
        scene_collected.append(True)

    def do():
        scene = TVTKScene()
        reference = weakref.ref(scene, scene_collected_callback)
        scene.close()
        return reference
    with restore_gc_state():
        gc.disable()
        scene_weakref = do()
    scene_weakref.assertTrue(scene_collected[0])

dataset/ETHPy150Open enthought/mayavi/tvtk/tests/test_tvtk_scene.py TestTVTKScene.test_tvtk_scene_garbage_collected/VarMisuse@91/124 `self`->`scene_weakref`