'Test some of the hard-to-reach parts of the parser, using a mock
parser.'

def _test_thorough(self, pd, before_root=True):

    (evt, node) = next(pd)
    self.assertEqual(pulldom.START_DOCUMENT, evt)
    self.assertTrue(hasattr(node, 'createElement'))
    if before_root:
        (evt, node) = next(pd)
        self.assertEqual(pulldom.COMMENT, evt)
        self.assertEqual('a    comment', node.data)
        (evt, node) = next(pd)
        self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt)
        self.assertEqual('target', node.target)
        self.assertEqual('data', node.data)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('html', node.tagName)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.COMMENT, evt)
    self.assertEqual('a    comment', node.data)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt)
    self.assertEqual('target', node.target)
    self.assertEqual('data', node.data)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('p', node.tagName)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.CHARACTERS, evt)
    self.assertEqual('text', node.data)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    self.assertEqual('p', node.tagName)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    self.assertEqual('html', node.tagName)
    (evt, node) = next(pd)
    self.assertEqual(pulldom.END_DOCUMENT, evt)
