MCPcopy
hub / github.com/scrapy/scrapy / test_fields_to_export

Method test_fields_to_export

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

Source from the content-addressed store, hash-verified

108 assert res == "22"
109
110 def test_fields_to_export(self):
111 ie = self._get_exporter(fields_to_export=["name"])
112 assert list(ie._get_serialized_fields(self.i)) == [("name", "John\xa3")]
113
114 ie = self._get_exporter(fields_to_export=["name"], encoding="latin-1")
115 _, name = next(iter(ie._get_serialized_fields(self.i)))
116 assert isinstance(name, str)
117 assert name == "John\xa3"
118
119 ie = self._get_exporter(fields_to_export={"name": "名稱"})
120 assert list(ie._get_serialized_fields(self.i)) == [("名稱", "John\xa3")]
121
122 def test_field_custom_serializer(self):
123 i = self.custom_field_item_class(name="John\xa3", age="22")

Callers

nothing calls this directly

Calls 2

_get_exporterMethod · 0.95

Tested by

no test coverage detected