def testRunsInitCodeOnImportWithFailure(self): _altair._register_hook() altair = importlib.import_module('altair') self.assertNotIn('COLAB_ALTAIR_IMPORT_HOOK_EXCEPTION', os.environ) self.assertIn('altair', sys.modules) self.assertEqual('colab', altair.renderers.active) # Reload of the module should not re-execute code. # Modify the active renderer and ensure that a reload doesn't reset it to # colab. altair.renderers.enable('default') self.assertEqual('default', altair.renderers.active) altair = reload_module(altair) self.assertNotIn('COLAB_ALTAIR_IMPORT_HOOK_EXCEPTION', os.environ) self.assertIn('altair', sys.modules) self.assertEqual('default', altair.renderers.active)
def _register_hooks(): _altair._register_hook() # pylint:disable=protected-access
def _register_hooks(): _altair._register_hook() # pylint:disable=protected-access _bokeh._register_hook() # pylint:disable=protected-access _cv2._register_hook() # pylint:disable=protected-access _tensorflow._register_hook() # pylint:disable=protected-access