          self.assertRaises(ImportError, serializers.serialize, "yaml", [jane])
  
      def test_deserializer_pyyaml_error_message(self):
          """Using yaml deserializer without pyyaml raises ImportError"""
          self.assertRaises(ImportError, serializers.deserialize, "yaml", "")
  
      def test_dumpdata_pyyaml_error_message(self):
          """Calling dumpdata produces an error when yaml package missing"""
          with six.assertRaisesRegex(self, management.CommandError, YAML_IMPORT_ERROR_MESSAGE):
              management.call_command('dumpdata', format='yaml')
 
</s> remove         self.assertRaises(ImportError, serializers.serialize, "yaml", [jane])
 </s> add         with self.assertRaises(ImportError):
            serializers.serialize("yaml", [jane]) </s> remove         self.assertRaises(ImportError, get_storage_class,
                          'django.core.files.storage.NonExistingStorage')
 </s> add         with self.assertRaises(ImportError):
            get_storage_class('django.core.files.storage.NonExistingStorage') </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, 'egg_module.bad_module')
 </s> add             with self.assertRaises(ImportError):
                import_module('egg_module.bad_module') </s> remove         self.assertRaises(ImportError, import_module, 'utils_tests.test_module.bad_module')
 </s> add         with self.assertRaises(ImportError):
            import_module('utils_tests.test_module.bad_module')
        with self.assertRaises(ImportError):
            serializers.deserialize("yaml", "")
          self.assertRaises(ImportError, serializers.serialize, "yaml", [jane])
  
      def test_deserializer_pyyaml_error_message(self):
          """Using yaml deserializer without pyyaml raises ImportError"""
        with self.assertRaises(ImportError):
            serializers.deserialize("yaml", "")
  
      def test_dumpdata_pyyaml_error_message(self):
          """Calling dumpdata produces an error when yaml package missing"""
          with six.assertRaisesRegex(self, management.CommandError, YAML_IMPORT_ERROR_MESSAGE):
              management.call_command('dumpdata', format='yaml')
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/serializers/test_yaml.py