'Test DOMEventStream parsing semantics.'

def test_parse_semantics(self):

    items = pulldom.parseString(SMALL_SAMPLE)
    (evt, node) = next(items)
    self.assertTrue(hasattr(node, 'createElement'))
    self.assertEqual(pulldom.START_DOCUMENT, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('html', node.tagName)
    self.assertEqual(2, len(node.attributes))
    self.assertEqual(node.attributes.getNamedItem('xmlns:xdc').value, 'http://www.xml.com/books')
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual('title', node.tagName)
    title_node = node
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    self.assertEqual('Introduction    to    XSL', node.data)
    (evt, node) = next(items)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    self.assertEqual('title', node.tagName)
    self.assertTrue((title_node is node))
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('hr', node.tagName)
    (evt, node) = next(items)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    self.assertEqual('hr', node.tagName)
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('p', node.tagName)
    (evt, node) = next(items)
    self.assertEqual(pulldom.START_ELEMENT, evt)
    self.assertEqual('xdc:author', node.tagName)
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    self.assertEqual('xdc:author', node.tagName)
    (evt, node) = next(items)
    self.assertEqual(pulldom.END_ELEMENT, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.CHARACTERS, evt)
    (evt, node) = next(items)
    self.assertEqual(pulldom.END_ELEMENT, evt)
