MCPcopy
hub / github.com/scrapy/scrapy / test_stats_calculation_no_elapsed_time

Method test_stats_calculation_no_elapsed_time

tests/test_logstats.py:68–75  ·  view source on GitHub ↗

The stat values should be None since the elapsed time is 0.

(self)

Source from the content-addressed store, hash-verified

66 assert self.stats.get_value("items_per_minute") is None
67
68 def test_stats_calculation_no_elapsed_time(self):
69 """The stat values should be None since the elapsed time is 0."""
70 logstats = LogStats.from_crawler(self.crawler)
71 self.stats.set_value("start_time", datetime.fromtimestamp(1655100172))
72 self.stats.set_value("finish_time", datetime.fromtimestamp(1655100172))
73 logstats.spider_closed(self.spider, "test reason")
74 assert self.stats.get_value("responses_per_minute") is None
75 assert self.stats.get_value("items_per_minute") is None

Callers

nothing calls this directly

Calls 4

from_crawlerMethod · 0.45
set_valueMethod · 0.45
spider_closedMethod · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected