MCPcopy
hub / github.com/scrapy/scrapy / test_parse_rows

Method test_parse_rows

tests/test_spider.py:176–191  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

174 spider_class = CSVFeedSpider
175
176 def test_parse_rows(self):
177 body = get_testdata("feeds", "feed-sample6.csv")
178 response = Response("http://example.org/dummy.csv", body=body)
179
180 class _CrawlSpider(self.spider_class):
181 name = "test"
182 delimiter = ","
183 quotechar = "'"
184
185 def parse_row(self, response, row):
186 return row
187
188 spider = _CrawlSpider()
189 rows = list(spider.parse_rows(response))
190 assert rows[0] == {"id": "1", "name": "alpha", "value": "foobar"}
191 assert len(rows) == 4
192
193
194class TestNoParseMethodSpider:

Callers

nothing calls this directly

Calls 4

get_testdataFunction · 0.90
ResponseClass · 0.90
parse_rowsMethod · 0.80
_CrawlSpiderClass · 0.70

Tested by

no test coverage detected