mirror of https://github.com/scrapy/scrapy.git
PY3 port test_logformatter
This commit is contained in:
parent
642af00bb7
commit
68a47ade46
|
|
@ -20,7 +20,6 @@ tests/test_downloadermiddleware_retry.py
|
|||
tests/test_downloadermiddleware_stats.py
|
||||
tests/test_downloadermiddleware_useragent.py
|
||||
tests/test_engine.py
|
||||
tests/test_logformatter.py
|
||||
tests/test_mail.py
|
||||
tests/test_pipeline_files.py
|
||||
tests/test_pipeline_images.py
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import unittest
|
||||
import six
|
||||
|
||||
from scrapy.spiders import Spider
|
||||
from scrapy.http import Request, Response
|
||||
|
|
@ -42,7 +43,7 @@ class LoggingContribTest(unittest.TestCase):
|
|||
logkws = self.formatter.dropped(item, exception, response, self.spider)
|
||||
logline = logkws['msg'] % logkws['args']
|
||||
lines = logline.splitlines()
|
||||
assert all(isinstance(x, unicode) for x in lines)
|
||||
assert all(isinstance(x, six.text_type) for x in lines)
|
||||
self.assertEqual(lines, [u"Dropped: \u2018", '{}'])
|
||||
|
||||
def test_scraped(self):
|
||||
|
|
@ -52,7 +53,7 @@ class LoggingContribTest(unittest.TestCase):
|
|||
logkws = self.formatter.scraped(item, response, self.spider)
|
||||
logline = logkws['msg'] % logkws['args']
|
||||
lines = logline.splitlines()
|
||||
assert all(isinstance(x, unicode) for x in lines)
|
||||
assert all(isinstance(x, six.text_type) for x in lines)
|
||||
self.assertEqual(lines, [u"Scraped from <200 http://www.example.com>", u'name: \xa3'])
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in New Issue