Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Merge remote-tracking branch 'scrapy/master' into issue5043-feed_export

Adrián Chaves32bc8bd436a2
diff --cc tests/test_exporters.py
index bec8d2267,8e0999348..34475b05d
--- a/tests/test_exporters.py
+++ b/tests/test_exporters.py
@@@ -338,9 -346,9 +354,10 @@@ class CsvItemExporterTest(BaseItemExpor
ie.export_item(item)
ie.export_item(item)
ie.finish_exporting()
+ del ie # See the first “del self.ie” in this file for context.
- self.assertCsvEqual(output.getvalue(),
- b'age,name\r\n22,John\xc2\xa3\r\n22,John\xc2\xa3\r\n')
+ self.assertCsvEqual(
+ output.getvalue(), b"age,name\r\n22,John\xc2\xa3\r\n22,John\xc2\xa3\r\n"
+ )
def test_header_no_header_line(self):
for item in [self.i, ItemAdapter(self.i).asdict()]:
@@@ -545,9 -553,8 +564,9 @@@ class JsonLinesItemExporterTest(BaseIte
self.ie.start_exporting()
self.ie.export_item(item)
self.ie.finish_exporting()
+ del self.ie # See the first “del self.ie” in this file for context.
exported = json.loads(to_unicode(self.output.getvalue()))
- item['time'] = str(item['time'])
+ item["time"] = str(item["time"])
self.assertEqual(exported, item)
@@@ -573,9 -580,10 +592,11 @@@ class JsonItemExporterTest(JsonLinesIte
self.ie.export_item(item)
self.ie.export_item(item)
self.ie.finish_exporting()
+ del self.ie # See the first “del self.ie” in this file for context.
exported = json.loads(to_unicode(self.output.getvalue()))
- self.assertEqual(exported, [ItemAdapter(item).asdict(), ItemAdapter(item).asdict()])
+ self.assertEqual(
+ exported, [ItemAdapter(item).asdict(), ItemAdapter(item).asdict()]
+ )
def test_two_items(self):
self.assertTwoItemsExported(self.i)
@@@ -590,9 -598,11 +611,12 @@@
self.ie.start_exporting()
self.ie.export_item(i3)
self.ie.finish_exporting()
+ del self.ie # See the first “del self.ie” in this file for context.
exported = json.loads(to_unicode(self.output.getvalue()))
- expected = {'name': 'Jesus', 'age': {'name': 'Maria', 'age': ItemAdapter(i1).asdict()}}
+ expected = {
+ "name": "Jesus",
+ "age": {"name": "Maria", "age": ItemAdapter(i1).asdict()},
+ }
self.assertEqual(exported, [expected])
def test_nested_dict_item(self):
@@@ -602,9 -612,8 +626,9 @@@
self.ie.start_exporting()
self.ie.export_item(i3)
self.ie.finish_exporting()
+ del self.ie # See the first “del self.ie” in this file for context.
exported = json.loads(to_unicode(self.output.getvalue()))
- expected = {'name': 'Jesus', 'age': {'name': 'Maria', 'age': i1}}
+ expected = {"name": "Jesus", "age": {"name": "Maria", "age": i1}}
self.assertEqual(exported, [expected])
def test_nonstring_types_item(self):
@@@ -612,9 -621,8 +636,9 @@@
self.ie.start_exporting()
self.ie.export_item(item)
self.ie.finish_exporting()
+ del self.ie # See the first “del self.ie” in this file for context.
exported = json.loads(to_unicode(self.output.getvalue()))
- item['time'] = str(item['time'])
+ item["time"] = str(item["time"])
self.assertEqual(exported, [item])