MCPcopy Index your code
hub / github.com/RustPython/RustPython / SAXExerciser

Class SAXExerciser

Lib/test/test_pulldom.py:238–269  ·  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

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