Merge pull request #3092 from scrapy/fix-tests-for-w3lib-1.19

Fix tests to account for changes in w3lib 1.19
This commit is contained in:
Daniel Graña 2018-01-26 13:52:21 -03:00 committed by GitHub
commit 8be28fe4ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -272,7 +272,10 @@ class TextResponseTest(BaseResponseTest):
headers={"Content-type": ["text/html; charset=utf-8"]},
body=b"\xef\xbb\xbfWORD\xe3\xab")
self.assertEqual(r6.encoding, 'utf-8')
self.assertEqual(r6.text, u'WORD\ufffd\ufffd')
self.assertIn(r6.text, {
u'WORD\ufffd\ufffd', # w3lib < 1.19.0
u'WORD\ufffd', # w3lib >= 1.19.0
})
def test_bom_is_removed_from_body(self):
# Inferring encoding from body also cache decoded body as sideeffect,