|
1 | 1 | from __future__ import absolute_import
|
2 | 2 | import re
|
3 | 3 | import json
|
| 4 | +import marshal |
| 5 | +import tempfile |
4 | 6 | import unittest
|
5 | 7 | from io import BytesIO
|
6 | 8 | from six.moves import cPickle as pickle
|
|
12 | 14 | from scrapy.utils.python import to_unicode
|
13 | 15 | from scrapy.exporters import (
|
14 | 16 | BaseItemExporter, PprintItemExporter, PickleItemExporter, CsvItemExporter,
|
15 |
| - XmlItemExporter, JsonLinesItemExporter, JsonItemExporter, PythonItemExporter |
| 17 | + XmlItemExporter, JsonLinesItemExporter, JsonItemExporter, |
| 18 | + PythonItemExporter, MarshalItemExporter |
16 | 19 | )
|
17 | 20 |
|
18 | 21 |
|
@@ -163,6 +166,17 @@ def test_export_multiple_items(self):
|
163 | 166 | self.assertEqual(pickle.load(f), i2)
|
164 | 167 |
|
165 | 168 |
|
| 169 | +class MarshalItemExporterTest(BaseItemExporterTest): |
| 170 | + |
| 171 | + def _get_exporter(self, **kwargs): |
| 172 | + self.output = tempfile.TemporaryFile() |
| 173 | + return MarshalItemExporter(self.output, **kwargs) |
| 174 | + |
| 175 | + def _check_output(self): |
| 176 | + self.output.seek(0) |
| 177 | + self._assert_expected_item(marshal.load(self.output)) |
| 178 | + |
| 179 | + |
166 | 180 | class CsvItemExporterTest(BaseItemExporterTest):
|
167 | 181 | def _get_exporter(self, **kwargs):
|
168 | 182 | return CsvItemExporter(self.output, **kwargs)
|
|
0 commit comments