diff options
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 11a2e7d52d..29e1f102ab 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -9,6 +9,11 @@ from .models import ( ) +class Nested(): + class Field(models.Field): + pass + + class BasicFieldTests(TestCase): def test_show_hidden_initial(self): @@ -33,6 +38,10 @@ class BasicFieldTests(TestCase): f = models.fields.CharField() self.assertEqual(repr(f), '<django.db.models.fields.CharField>') + def test_field_repr_nested(self): + """__repr__() uses __qualname__ for nested class support.""" + self.assertEqual(repr(Nested.Field()), '<model_fields.tests.Nested.Field>') + def test_field_name(self): """ A defined field name (name="fieldname") is used instead of the model @@ -85,6 +94,11 @@ class BasicFieldTests(TestCase): field._get_default pickle.dumps(field) + def test_deconstruct_nested_field(self): + """deconstruct() uses __qualname__ for nested class support.""" + name, path, args, kwargs = Nested.Field().deconstruct() + self.assertEqual(path, 'model_fields.tests.Nested.Field') + class ChoicesTests(SimpleTestCase): |
