MCPcopy Index your code
hub / github.com/python/cpython / test_expat_dtdhandler

Method test_expat_dtdhandler

Lib/test/test_sax.py:972–986  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

970 return source
971
972 def test_expat_dtdhandler(self):
973 parser = create_parser()
974 handler = self.TestDTDHandler()
975 parser.setDTDHandler(handler)
976
977 parser.feed('<!DOCTYPE doc [\n')
978 parser.feed(' <!ENTITY img SYSTEM "expat.gif" NDATA GIF>\n')
979 parser.feed(' <!NOTATION GIF PUBLIC "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN">\n')
980 parser.feed(']>\n')
981 parser.feed('<doc></doc>')
982 parser.close()
983
984 self.assertEqual(handler._notations,
985 [("GIF", "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN", None)])
986 self.assertEqual(handler._entities, [("img", None, "expat.gif", "GIF")])
987
988 def test_expat_external_dtd_enabled(self):
989 # clear _opener global variable

Callers

nothing calls this directly

Calls 5

create_parserFunction · 0.90
setDTDHandlerMethod · 0.80
feedMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected