pass test_externalUnicodeInterference - the logic for py3 is clearly inverse of what was expected in this test, as scrapy Request url must be unicode

This commit is contained in:
Konstantin Lopuhin 2016-01-14 12:25:54 +03:00
parent 1d5ab67183
commit 945674eb8f
1 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from twisted.internet import defer
Tests borrowed from the twisted.web.client tests.
"""
import os
import six
from six.moves.urllib.parse import urlparse
from twisted.trial import unittest
@ -75,8 +76,10 @@ class ParseUrlTestCase(unittest.TestCase):
elements of its return tuple, even when passed an URL which has
previously been passed to L{urlparse} as a C{unicode} string.
"""
badInput = u'http://example.com/path'
goodInput = badInput.encode('ascii')
goodInput = u'http://example.com/path'
badInput = goodInput.encode('ascii')
if six.PY2:
goodInput, badInput = badInput, goodInput
urlparse(badInput)
scheme, netloc, host, port, path = self._parse(goodInput)
self.assertTrue(isinstance(scheme, str))