Scrapy, a fast high-level web crawling & scraping framework for Python.
made BaseField.to_python() raise NotImplementedError (already documented) and adapted unittest
Pablo Hoffmanae82f8c70df1
diff --git a/scrapy/contrib_exp/newitem/fields.py b/scrapy/contrib_exp/newitem/fields.pyindex 44dbef5e6..97f7efb54 100644--- a/scrapy/contrib_exp/newitem/fields.py+++ b/scrapy/contrib_exp/newitem/fields.py@@ -9,14 +9,9 @@ class BaseField(object):self._default = self.to_python(default) if default is not None else Nonedef to_python(self, value):- """- Converts the input value into the expected Python data type.- Subclasses should override this.- """- return value+ raise NotImplementedError()def get_default(self):- """Returns the default value for the field."""return self._defaultdiff --git a/scrapy/tests/test_newitem.py b/scrapy/tests/test_newitem.pyindex d1fbc8dc5..95cced7a0 100644--- a/scrapy/tests/test_newitem.py+++ b/scrapy/tests/test_newitem.py@@ -125,7 +125,7 @@ class NewItemFieldsTest(unittest.TestCase):f = fields.BaseField()assert f.get_default() is None- assert f.to_python(1) == 1+ self.assertRaises(NotImplementedError, f.to_python, 1)def test_boolean_field(self):class TestItem(Item):