def test_zz_object_cache(self):
        # HACK!  The zz in the method name ensures that this is run
        # last.  The reloading messes up some of the other tests
        # because the Prop classes base class is different.

        l1 = len(tvtk_base._object_cache)
        p = Prop()
        addr = p._vtk_obj.__this__
        self.assertEqual(l1 + 1, len(tvtk_base._object_cache))
        self.assertEqual(p, tvtk_base._object_cache.get(addr))

        del p
        gc.collect() # Force collection.
        self.assertEqual(l1, len(tvtk_base._object_cache))
        self.assertEqual(addr in tvtk_base._object_cache, False)

        # Check reload-safety.
        p = Prop()
        l1 = len(tvtk_base._object_cache)
        imp.reload(tvtk_base)
        self.assertEqual(l1, len(tvtk_base._object_cache))

    # Reloading causes havoc with nosetests based tests so we skip in
    # that case.  Unittest will see the test just fine.
Test if object cache works correctly.
dataset/ETHPy150Open enthought/mayavi/tvtk/tests/test_tvtk_base.py/TestTVTKBase.test_zz_object_cache