MCPcopy
hub / github.com/scrapy/scrapy / assertExportedMarshal

Method assertExportedMarshal

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

Source from the content-addressed store, hash-verified

174 assert got_batch == expected_batch
175
176 async def assertExportedMarshal(self, items, rows, settings=None):
177 settings = settings or {}
178 settings.update(
179 {
180 "FEEDS": {
181 self._random_temp_filename() / "marshal" / self._file_mark: {
182 "format": "marshal"
183 },
184 },
185 }
186 )
187 batch_size = Settings(settings).getint("FEED_EXPORT_BATCH_ITEM_COUNT")
188 rows = [{k: v for k, v in row.items() if v} for row in rows]
189 data = await self.exported_data(items, settings)
190
191 for batch in data["marshal"]:
192 got_batch = self._load_until_eof(batch, load_func=marshal.load)
193 expected_batch, rows = rows[:batch_size], rows[batch_size:]
194 assert got_batch == expected_batch
195
196 @coroutine_test
197 async def test_export_items(self):

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected