Scrapy, a fast high-level web crawling & scraping framework for Python.
Simple test for default values of model in DjangoItem
Vladislav Poluhin0497ac2fc86d
diff --git a/scrapy/tests/test_djangoitem/__init__.py b/scrapy/tests/test_djangoitem/__init__.pyindex 46ce4a012..e3ffb176f 100644--- a/scrapy/tests/test_djangoitem/__init__.py+++ b/scrapy/tests/test_djangoitem/__init__.py@@ -78,3 +78,7 @@ class DjangoItemTest(unittest.TestCase):self.assertEqual(person.name, 'John')+ def test_default_field_values(self):+ i = BasePersonItem()+ person = i.save(commit=False)+ self.assertEqual(person.name, 'Robot')diff --git a/scrapy/tests/test_djangoitem/models.py b/scrapy/tests/test_djangoitem/models.pyindex d2098632a..2beaee752 100644--- a/scrapy/tests/test_djangoitem/models.py+++ b/scrapy/tests/test_djangoitem/models.py@@ -2,7 +2,7 @@ from django.db import modelsclass Person(models.Model):- name = models.CharField(max_length=255)+ name = models.CharField(max_length=255, default='Robot')age = models.IntegerField()class Meta: