'L{_SourceFragmentElement} renders source lines at and around the line
number indicated by a frame object.'

def test_sourceFragmentElement(self):

    element = _SourceFragmentElement(TagLoader(tags.div(tags.span(render='lineNumber'), tags.span(render='sourceLine'), render='sourceLines')), self.frame)
    source = [u'    \xa0    \xa0message    =    "This    is    a    problem"', u'    \xa0    \xa0raise    Exception(message)', u'#    Figure    out    the    line    number    from    which    the    exception    will    be    raised.']
    d = flattenString(None, element)
    if _PY3:
        stringToCheckFor = ''.join([('<div    class="snippet%sLine"><span>%d</span><span>%s</span></div>' % (['', 'Highlight'][(lineNumber == 1)], (self.base + lineNumber), ((u'    \xa0' * 4) + sourceLine))) for (lineNumber, sourceLine) in enumerate(source)]).encode('utf8')
    else:
        stringToCheckFor = ''.join([('<div    class="snippet%sLine"><span>%d</span><span>%s</span></div>' % (['', 'Highlight'][(lineNumber == 1)], (self.base + lineNumber), ((u'    \xa0' * 4) + sourceLine).encode('utf8'))) for (lineNumber, sourceLine) in enumerate(source)])
    d.addCallback(self.assertEqual, stringToCheckFor)
    return d
