          self.assertEqual(mod.content, 'Good Module')
  
          # A child that exists, but will generate an import error if loaded
          self.assertTrue(module_has_submodule(test_module, 'bad_module'))
          self.assertRaises(ImportError, import_module, 'utils_tests.test_module.bad_module')
  
          # A child that doesn't exist
          self.assertFalse(module_has_submodule(test_module, 'no_such_module'))
          self.assertRaises(ImportError, import_module, 'utils_tests.test_module.no_such_module')
  
 
</s> remove             self.assertRaises(ImportError, import_module, 'egg_module.bad_module')
 </s> add             with self.assertRaises(ImportError):
                import_module('egg_module.bad_module') </s> remove             self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.bad_module')
 </s> add             with self.assertRaises(ImportError):
                import_module('egg_module.sub1.sub2.bad_module') </s> remove         self.assertRaises(ImportError, import_module, 'utils_tests.test_module.no_such_module')
 </s> add         with self.assertRaises(ImportError):
            import_module('utils_tests.test_module.no_such_module') </s> remove         self.assertRaises(ImportError, import_module, 'utils_tests.test_module.django')
 </s> add         with self.assertRaises(ImportError):
            import_module('utils_tests.test_module.django') </s> remove             self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')
 </s> add             with self.assertRaises(ImportError):
                import_module('egg_module.sub1.sub2.no_such_module')
        with self.assertRaises(ImportError):
            import_module('utils_tests.test_module.bad_module')
          self.assertEqual(mod.content, 'Good Module')
  
          # A child that exists, but will generate an import error if loaded
          self.assertTrue(module_has_submodule(test_module, 'bad_module'))
        with self.assertRaises(ImportError):
            import_module('utils_tests.test_module.bad_module')
  
          # A child that doesn't exist
          self.assertFalse(module_has_submodule(test_module, 'no_such_module'))
          self.assertRaises(ImportError, import_module, 'utils_tests.test_module.no_such_module')
  
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/utils_tests/test_module_loading.py