diff options
| author | Morgan Aubert <morgan@aubert.email> | 2016-12-14 14:04:26 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-14 14:04:26 -0500 |
| commit | ef889d5b10c02c8f0c19f7384fbb51d291240bee (patch) | |
| tree | 7bc75a3cabd914ee1dfa0c3c27502484eeb6437f /tests/model_fields | |
| parent | 3be2268992767d203159818c5353f959360808a7 (diff) | |
Fixed #27599 -- Fixed Field.__str__() crash for fields not attached to models.
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/tests.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index f7faf399c7..5869196335 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -1,7 +1,6 @@ from django import forms from django.db import models from django.test import SimpleTestCase, TestCase -from django.utils.encoding import force_str from .models import ( Foo, RenamedField, VerboseNameField, Whiz, WhizIter, WhizIterEmpty, @@ -56,8 +55,10 @@ class BasicFieldTests(TestCase): self.assertIsInstance(field.formfield(choices_form_class=klass), klass) def test_field_str(self): + f = models.Field() + self.assertEqual(str(f), '<django.db.models.fields.Field>') f = Foo._meta.get_field('a') - self.assertEqual(force_str(f), 'model_fields.Foo.a') + self.assertEqual(str(f), 'model_fields.Foo.a') def test_field_ordering(self): """Fields are ordered based on their creation.""" |
