'The C{\'wsgi.errors\'} file-like object from the C{environ} C{dict}
expects writes of only native strings in Python 2. Some existing WSGI
applications may write non-native (i.e. C{unicode}) strings so, for
compatibility, these elicit only a warning in Python 2.'

def test_wsgiErrorsExpectsOnlyNativeStringsInPython2(self):

    if _PY3:
        raise SkipTest('Not    relevant    in    Python    3')
    (request, result) = self.prepareRequest()
    request.requestReceived()
    (environ, _) = self.successResultOf(result)
    errors = environ['wsgi.errors']
    with warnings.catch_warnings(record=True) as caught:
        errors.write(u'fred')
    self.assertEqual(1, len(caught))
    self.assertEqual(UnicodeWarning, caught[0].category)
    self.assertEqual("write()    argument    should    be    str,    not    u'fred'    (unicode)", str(caught[0].message))
