'test that htmlentityreplace formatting is applied to
exceptions reported with format_exceptions=True'

@requires_pygments_14
def test_utf8_format_exceptions_pygments(self):

    l = TemplateLookup(format_exceptions=True)
    if compat.py3k:
        l.put_string('foo.html', "#    -*-    coding:    utf-8    -*-\n${'\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82'    +    foobar}")
    else:
        l.put_string('foo.html', "#    -*-    coding:    utf-8    -*-\n${u'\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82'    +    foobar}")
    if compat.py3k:
        assert ('<table    class="error    syntax-highlightedtable"><tr><td    class="linenos"><div    class="linenodiv"><pre>2</pre></div></td><td    class="code"><div    class="error    syntax-highlighted"><pre><span    class="cp">${</span><span    class="s">&#39;\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82&#39;</span>    <span    class="o">+</span>    <span    class="n">foobar</span><span    class="cp">}</span><span    class="x"></span>' in result_lines(l.get_template('foo.html').render().decode('utf-8')))
    else:
        assert ('<table    class="error    syntax-highlightedtable"><tr><td    class="linenos"><div    class="linenodiv"><pre>2</pre></div></td><td    class="code"><div    class="error    syntax-highlighted"><pre><span    class="cp">${</span><span    class="s">u&#39;&#x43F;&#x440;&#x438;&#x432;&#x435;&#x442;&#39;</span>    <span    class="o">+</span>    <span    class="n">foobar</span><span    class="cp">}</span><span    class="x"></span>' in result_lines(l.get_template('foo.html').render().decode('utf-8')))
