MCPcopy
hub / github.com/scrapy/scrapy / assertExportedJsonLines

Method assertExportedJsonLines

tests/test_feedexport_batch.py:65–84  ·  view source on GitHub ↗
(self, items, rows, settings=None)

Source from the content-addressed store, hash-verified

63 return content
64
65 async def assertExportedJsonLines(self, items, rows, settings=None):
66 settings = settings or {}
67 settings.update(
68 {
69 "FEEDS": {
70 self._random_temp_filename() / "jl" / self._file_mark: {
71 "format": "jl"
72 },
73 },
74 }
75 )
76 batch_size = Settings(settings).getint("FEED_EXPORT_BATCH_ITEM_COUNT")
77 rows = [{k: v for k, v in row.items() if v} for row in rows]
78 data = await self.exported_data(items, settings)
79 for batch in data["jl"]:
80 got_batch = [
81 json.loads(to_unicode(batch_item)) for batch_item in batch.splitlines()
82 ]
83 expected_batch, rows = rows[:batch_size], rows[batch_size:]
84 assert got_batch == expected_batch
85
86 async def assertExportedCsv(self, items, header, rows, settings=None):
87 settings = settings or {}

Callers

nothing calls this directly

Calls 7

SettingsClass · 0.90
to_unicodeFunction · 0.90
_random_temp_filenameMethod · 0.80
getintMethod · 0.80
itemsMethod · 0.80
exported_dataMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected