Skip to content

Commit a6116a5

Browse files
chore: linting
Signed-off-by: Nilton Junior <ngm.junior@outlook.com>
1 parent 7df322d commit a6116a5

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

spidermon/contrib/scrapy/extensions.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ def _get_skip_values_list(self, settings):
8888
pass
8989

9090
# Fall back to Scrapy's getlist (converts to list of strings)
91-
return settings.getlist(
92-
"SPIDERMON_FIELD_COVERAGE_SKIP_VALUES", []
93-
)
91+
return settings.getlist("SPIDERMON_FIELD_COVERAGE_SKIP_VALUES", [])
9492

9593
# For any other type, try to convert to list
9694
return list(value) if value else []
@@ -298,9 +296,9 @@ def _run_suites(self, spider, suites):
298296
def _generate_data_for_spider(self, spider):
299297
return {
300298
"stats": self.crawler.stats.get_stats(spider),
301-
"stats_history": spider.stats_history
302-
if hasattr(spider, "stats_history")
303-
else [],
299+
"stats_history": (
300+
spider.stats_history if hasattr(spider, "stats_history") else []
301+
),
304302
"crawler": self.crawler,
305303
"spider": spider,
306304
"sc_spider_name": get_spider_name(spider),

tests/test_item_scraped_signal.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,12 @@ def test_item_scraped_count_ignore_custom_skip_values():
544544
stats = spider.crawler.stats.get_stats()
545545

546546
assert stats.get("spidermon_item_scraped_count/dict/field1") == 3
547-
assert stats.get("spidermon_item_scraped_count/dict/field2") == 1 # Only the valid value
548-
assert stats.get("spidermon_item_scraped_count/dict/field3") == 2 # Only the valid values (skipped "TBD")
547+
assert (
548+
stats.get("spidermon_item_scraped_count/dict/field2") == 1
549+
) # Only the valid value
550+
assert (
551+
stats.get("spidermon_item_scraped_count/dict/field3") == 2
552+
) # Only the valid values (skipped "TBD")
549553

550554

551555
def test_item_scraped_count_do_not_ignore_custom_skip_values_by_default():
@@ -574,7 +578,9 @@ def test_item_scraped_count_do_not_ignore_custom_skip_values_by_default():
574578
stats = spider.crawler.stats.get_stats()
575579

576580
assert stats.get("spidermon_item_scraped_count/dict/field1") == 2
577-
assert stats.get("spidermon_item_scraped_count/dict/field2") == 2 # Counted because skip_values not set
581+
assert (
582+
stats.get("spidermon_item_scraped_count/dict/field2") == 2
583+
) # Counted because skip_values not set
578584

579585

580586
def test_item_scraped_count_skip_values_type_sensitive():
@@ -705,7 +711,9 @@ def test_item_scraped_count_skip_values_works_with_nested_fields():
705711

706712
assert stats.get("spidermon_item_scraped_count/dict/field1") == 2
707713
assert stats.get("spidermon_item_scraped_count/dict/field1/nested1") == 2
708-
assert stats.get("spidermon_item_scraped_count/dict/field1/nested2") == 1 # Only the valid value
714+
assert (
715+
stats.get("spidermon_item_scraped_count/dict/field1/nested2") == 1
716+
) # Only the valid value
709717

710718

711719
def test_item_scraped_count_skip_values_works_with_skip_falsy():

0 commit comments

Comments
 (0)