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

Class SAXExerciser

Lib/test/test_pulldom.py:235–266  ·  view source on GitHub ↗

A fake sax parser that calls some of the harder-to-reach sax methods to ensure it emits the correct events

Source from the content-addressed store, hash-verified

233
234
235class SAXExerciser(object):
236 """A fake sax parser that calls some of the harder-to-reach sax methods to
237 ensure it emits the correct events"""
238
239 def setContentHandler(self, handler):
240 self._handler = handler
241
242 def parse(self, _):
243 h = self._handler
244 h.startDocument()
245
246 # The next two items ensure that items preceding the first
247 # start_element are properly stored and emitted:
248 h.comment("a comment")
249 h.processingInstruction("target", "data")
250
251 h.startElement("html", AttributesImpl({}))
252
253 h.comment("a comment")
254 h.processingInstruction("target", "data")
255
256 h.startElement("p", AttributesImpl({"class": "paraclass"}))
257 h.characters("text")
258 h.endElement("p")
259 h.endElement("html")
260 h.endDocument()
261
262 def stub(self, *args, **kwargs):
263 """Stub method. Does nothing."""
264 pass
265 setProperty = stub
266 setFeature = stub
267
268
269class SAX2DOMExerciser(SAXExerciser):

Callers 2

test_thorough_parseMethod · 0.85
test_sax2dom_failMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_thorough_parseMethod · 0.68
test_sax2dom_failMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…