MCPcopy
hub / github.com/scrapy/scrapy / test_header_export_two_items

Method test_header_export_two_items

tests/test_exporters.py:320–331  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

318 )
319
320 def test_header_export_two_items(self):
321 for item in [self.i, ItemAdapter(self.i).asdict()]:
322 output = BytesIO()
323 ie = CsvItemExporter(output)
324 ie.start_exporting()
325 ie.export_item(item)
326 ie.export_item(item)
327 ie.finish_exporting()
328 del ie # See the first “del self.ie” in this file for context.
329 self.assertCsvEqual(
330 output.getvalue(), b"age,name\r\n22,John\xc2\xa3\r\n22,John\xc2\xa3\r\n"
331 )
332
333 def test_header_no_header_line(self):
334 for item in [self.i, ItemAdapter(self.i).asdict()]:

Callers

nothing calls this directly

Calls 5

export_itemMethod · 0.95
finish_exportingMethod · 0.95
assertCsvEqualMethod · 0.95
CsvItemExporterClass · 0.90
start_exportingMethod · 0.45

Tested by

no test coverage detected