From 945674eb8f351e71aea090f1e94c3fa337c52cf8 Mon Sep 17 00:00:00 2001 From: Konstantin Lopuhin Date: Thu, 14 Jan 2016 12:25:54 +0300 Subject: [PATCH] pass test_externalUnicodeInterference - the logic for py3 is clearly inverse of what was expected in this test, as scrapy Request url must be unicode --- tests/test_webclient.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_webclient.py b/tests/test_webclient.py index 3784aa401..84717e5eb 100644 --- a/tests/test_webclient.py +++ b/tests/test_webclient.py @@ -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))