

def test_no_dtd(self):
    "\n        The XML deserializer shouldn't allow a DTD.\n\n        This is the most straightforward way to prevent all entity definitions\n        and avoid both external entities and entity-expansion attacks.\n        "
    xml = '<?xml version="1.0" standalone="no"?><!DOCTYPE example SYSTEM "http://example.com/example.dtd">'
    with self.assertRaises(DTDForbidden):
        next(serializers.deserialize('xml', xml))

dataset/ETHPy150Open django/django/tests/serializers/test_xml.py XmlSerializerTestCase.test_no_dtd/original