Django 1.11 uses real class names in __repr__()

See https://code.djangoproject.com/ticket/27546 and
https://github.com/django/django/commit/48826aa
fix_request_path_info
Charlie Denton 2017-03-03 22:36:31 +00:00
parent 8e52bdf6d1
commit aefb7dabc2
No known key found for this signature in database
GPG Key ID: 5BBA1783DA191613
1 changed files with 5 additions and 1 deletions

View File

@ -360,7 +360,11 @@ class PolymorphicTests(TestCase):
# no pretty printing
ModelShow1_plain.objects.create(field1='abc')
ModelShow2_plain.objects.create(field1='abc', field2='def')
self.assertEqual(qrepr(ModelShow1_plain.objects.all()), '<QuerySet [<ModelShow1_plain: ModelShow1_plain object>, <ModelShow2_plain: ModelShow2_plain object>]>')
# repr classnames are not hardcoded in Django 1.11+
if django.VERSION >= (1, 11):
self.assertEqual(qrepr(ModelShow1_plain.objects.all()), '<PolymorphicQuerySet [<ModelShow1_plain: ModelShow1_plain object>, <ModelShow2_plain: ModelShow2_plain object>]>')
else:
self.assertEqual(qrepr(ModelShow1_plain.objects.all()), '<QuerySet [<ModelShow1_plain: ModelShow1_plain object>, <ModelShow2_plain: ModelShow2_plain object>]>')
def test_extra_method(self):
self.create_model2abcd()