          previous_i18n = settings.USE_I18N
          previous_l10n = settings.USE_L10N
          with self.settings(USE_I18N=False):
              del settings.USE_I18N
              self.assertRaises(AttributeError, getattr, settings, 'USE_I18N')
              # Should also work for a non-overridden setting
              del settings.USE_L10N
              self.assertRaises(AttributeError, getattr, settings, 'USE_L10N')
          self.assertEqual(settings.USE_I18N, previous_i18n)
          self.assertEqual(settings.USE_L10N, previous_l10n)
 
</s> remove             self.assertRaises(AttributeError, getattr, settings, 'USE_L10N')
 </s> add             with self.assertRaises(AttributeError):
                getattr(settings, 'USE_L10N') </s> remove         self.assertRaises(AttributeError, getattr, settings, 'TEST')
 </s> add         with self.assertRaises(AttributeError):
            getattr(settings, 'TEST') </s> remove         self.assertRaises(TypeError, delattr, settings, '_wrapped')
 </s> add         with self.assertRaises(TypeError):
            delattr(settings, '_wrapped') </s> remove         self.assertRaises(AttributeError, getattr, settings, 'TEST')
 </s> add         with self.assertRaises(AttributeError):
            getattr(settings, 'TEST') </s> remove         self.assertRaises(AttributeError, getattr, settings, 'TEST')
 </s> add         with self.assertRaises(AttributeError):
            getattr(settings, 'TEST')
            with self.assertRaises(AttributeError):
                getattr(settings, 'USE_I18N')
          previous_i18n = settings.USE_I18N
          previous_l10n = settings.USE_L10N
          with self.settings(USE_I18N=False):
              del settings.USE_I18N
            with self.assertRaises(AttributeError):
                getattr(settings, 'USE_I18N')
              # Should also work for a non-overridden setting
              del settings.USE_L10N
              self.assertRaises(AttributeError, getattr, settings, 'USE_L10N')
          self.assertEqual(settings.USE_I18N, previous_i18n)
          self.assertEqual(settings.USE_L10N, previous_l10n)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/settings_tests/tests.py