def nonvoid_cdata_elements(test, parse_function):
 markup = u'\n    <html> <head><{0}/></head> <body id="test"> </html>\n    '
 for tag in (cdataElements | rcdataElements):
  for x in (tag, tag.upper(), (u'\n' + tag), (tag + u' id="xxx" ')):
   root = parse_function(markup.format(x))
   test.assertEqual(len(XPath(u'//h:body[@id="test"]')(root)), 1, ((u'Incorrect parsing for <%s/>, parsed markup:\n' % x) + etree.tostring(root)))

def nonvoid_cdata_elements ( test , parse_function ) : markup = u'\n    <html> <head><{0}/></head> <body id="test"> </html>\n    ' for tag in ( cdataElements | rcdataElements ) : for x in ( tag , tag . upper ( ) , ( u'\n' + tag ) , ( tag + u' id="xxx" ' ) ) : root = parse_function ( markup . format ( x ) ) test . assertEqual ( len ( XPath ( u'//h:body[@id="test"]' ) ( root ) ) , 1 , ( ( u'Incorrect parsing for <%s/>, parsed markup:\n' % x ) + etree . tostring ( root ) ) )
if self closed version of non-void cdata elements like <title/> are present .