Fix Flake8-reported issues

This commit is contained in:
Adrián Chaves 2019-12-13 14:32:06 +01:00
parent 1fc2b140c1
commit a4ef9750f9
2 changed files with 8 additions and 6 deletions

View File

@ -88,7 +88,7 @@ flake8-ignore =
scrapy/http/response/__init__.py E501 E128 W293 W291
scrapy/http/response/text.py E501 W293 E128 E124
# scrapy/linkextractors
scrapy/linkextractors/__init__.py E731 E502 E501 E402
scrapy/linkextractors/__init__.py E731 E502 E501 E402 W504
scrapy/linkextractors/lxmlhtml.py E501 E731 E226
# scrapy/loader
scrapy/loader/__init__.py E501 E502 E128

View File

@ -514,25 +514,27 @@ class LxmlLinkExtractorTestCase(Base.LinkExtractorTestCase):
"""Make sure the FilteringLinkExtractor deprecation warning is not
issued for LxmlLinkExtractor"""
with catch_warnings(record=True) as warnings:
extractor = LxmlLinkExtractor()
LxmlLinkExtractor()
self.assertEqual(len(warnings), 0)
class SubclassedItem(LxmlLinkExtractor):
pass
subclassed_extractor = SubclassedItem()
SubclassedItem()
self.assertEqual(len(warnings), 0)
class FilteringLinkExtractorTest(unittest.TestCase):
def test_deprecation_warning(self):
args = [None]*10
args = [None] * 10
with catch_warnings(record=True) as warnings:
extractor = FilteringLinkExtractor(*args)
FilteringLinkExtractor(*args)
self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0].category, ScrapyDeprecationWarning)
with catch_warnings(record=True) as warnings:
class SubclassedFilteringLinkExtractor(FilteringLinkExtractor):
pass
subclassed_extractor = SubclassedFilteringLinkExtractor(*args)
SubclassedFilteringLinkExtractor(*args)
self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0].category, ScrapyDeprecationWarning)