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

Method assertExportedJsonLines

tests/test_feedexport.py:353–370  ·  view source on GitHub ↗
(
        self,
        items: Iterable[Any],
        rows: Iterable[dict[str, Any]],
        settings: dict[str, Any] | None = None,
    )

Source from the content-addressed store, hash-verified

351 assert rows == list(reader)
352
353 async def assertExportedJsonLines(
354 self,
355 items: Iterable[Any],
356 rows: Iterable[dict[str, Any]],
357 settings: dict[str, Any] | None = None,
358 ) -> None:
359 settings = settings or {}
360 settings.update(
361 {
362 "FEEDS": {
363 self._random_temp_filename(): {"format": "jl"},
364 },
365 }
366 )
367 data = await self.exported_data(items, settings)
368 parsed = [json.loads(to_unicode(line)) for line in data["jl"].splitlines()]
369 rows = [{k: v for k, v in row.items() if v} for row in rows]
370 assert rows == parsed
371
372 async def assertExportedXml(
373 self,

Calls 5

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

Tested by

no test coverage detected