mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #5931 -- Added __repr__ to db fields. Thanks, Thomas Güttler, emulbreh and magopian.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -48,6 +48,15 @@ class BasicFieldTests(test.TestCase):
|
||||
except ValidationError, e:
|
||||
self.fail("NullBooleanField failed validation with value of None: %s" % e.messages)
|
||||
|
||||
def test_field_repr(self):
|
||||
"""
|
||||
Regression test for #5931: __repr__ of a field also displays its name
|
||||
"""
|
||||
f = Foo._meta.get_field('a')
|
||||
self.assertEqual(repr(f), '<django.db.models.fields.CharField: a>')
|
||||
f = models.fields.CharField()
|
||||
self.assertEqual(repr(f), '<django.db.models.fields.CharField>')
|
||||
|
||||
class DecimalFieldTests(test.TestCase):
|
||||
def test_to_python(self):
|
||||
f = models.DecimalField(max_digits=4, decimal_places=2)
|
||||
|
||||
Reference in New Issue
Block a user