From 65764a9316b196006d4f0ee2cac773369805e56c Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 19 Nov 2015 15:33:22 -0500 Subject: [PATCH] Renamed __unicode__() to __str__() in some test comments. --- tests/admin_views/admin.py | 6 ++---- tests/admin_views/tests.py | 20 ++++++++++---------- tests/model_inheritance/tests.py | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py index 0da6126c01..2db28c6f51 100644 --- a/tests/admin_views/admin.py +++ b/tests/admin_views/admin.py @@ -508,8 +508,7 @@ class CoverLetterAdmin(admin.ModelAdmin): """ A ModelAdmin with a custom get_queryset() method that uses defer(), to test verbose_name display in messages shown after adding/editing CoverLetter - instances. - Note that the CoverLetter model defines a __unicode__ method. + instances. Note that the CoverLetter model defines a __str__ method. For testing fix for ticket #14529. """ @@ -545,8 +544,7 @@ class TelegramAdmin(admin.ModelAdmin): """ A ModelAdmin with a custom get_queryset() method that uses only(), to test verbose_name display in messages shown after adding/editing Telegram - instances. - Note that the Telegram model defines a __unicode__ method. + instances. Note that the Telegram model defines a __str__ method. For testing fix for ticket #14529. """ diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 07bfe2dac2..48182f2a4a 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -3811,7 +3811,7 @@ class AdminCustomQuerysetTest(TestCase): def test_add_model_modeladmin_defer_qs(self): # Test for #14529. defer() is used in ModelAdmin.get_queryset() - # model has __unicode__ method + # model has __str__ method self.assertEqual(CoverLetter.objects.count(), 0) # Emulate model instance creation via the admin post_data = { @@ -3831,7 +3831,7 @@ class AdminCustomQuerysetTest(TestCase): reverse('admin:admin_views_coverletter_change', args=(pk,)), html=True ) - # model has no __unicode__ method + # model has no __str__ method self.assertEqual(ShortMessage.objects.count(), 0) # Emulate model instance creation via the admin post_data = { @@ -3854,7 +3854,7 @@ class AdminCustomQuerysetTest(TestCase): def test_add_model_modeladmin_only_qs(self): # Test for #14529. only() is used in ModelAdmin.get_queryset() - # model has __unicode__ method + # model has __str__ method self.assertEqual(Telegram.objects.count(), 0) # Emulate model instance creation via the admin post_data = { @@ -3874,7 +3874,7 @@ class AdminCustomQuerysetTest(TestCase): reverse('admin:admin_views_telegram_change', args=(pk,)), html=True ) - # model has no __unicode__ method + # model has no __str__ method self.assertEqual(Paper.objects.count(), 0) # Emulate model instance creation via the admin post_data = { @@ -3897,7 +3897,7 @@ class AdminCustomQuerysetTest(TestCase): def test_edit_model_modeladmin_defer_qs(self): # Test for #14529. defer() is used in ModelAdmin.get_queryset() - # model has __unicode__ method + # model has __str__ method cl = CoverLetter.objects.create(author="John Doe") self.assertEqual(CoverLetter.objects.count(), 1) response = self.client.get(reverse('admin:admin_views_coverletter_change', args=(cl.pk,))) @@ -3912,7 +3912,7 @@ class AdminCustomQuerysetTest(TestCase): self.assertEqual(response.status_code, 200) self.assertEqual(CoverLetter.objects.count(), 1) # Message should contain non-ugly model verbose name. Instance - # representation is set by model's __unicode__() + # representation is set by model's __str__() self.assertContains( response, '
  • The cover letter "' @@ -3920,7 +3920,7 @@ class AdminCustomQuerysetTest(TestCase): reverse('admin:admin_views_coverletter_change', args=(cl.pk,)), html=True ) - # model has no __unicode__ method + # model has no __str__ method sm = ShortMessage.objects.create(content="This is expensive") self.assertEqual(ShortMessage.objects.count(), 1) response = self.client.get(reverse('admin:admin_views_shortmessage_change', args=(sm.pk,))) @@ -3946,7 +3946,7 @@ class AdminCustomQuerysetTest(TestCase): def test_edit_model_modeladmin_only_qs(self): # Test for #14529. only() is used in ModelAdmin.get_queryset() - # model has __unicode__ method + # model has __str__ method t = Telegram.objects.create(title="Frist Telegram") self.assertEqual(Telegram.objects.count(), 1) response = self.client.get(reverse('admin:admin_views_telegram_change', args=(t.pk,))) @@ -3961,7 +3961,7 @@ class AdminCustomQuerysetTest(TestCase): self.assertEqual(response.status_code, 200) self.assertEqual(Telegram.objects.count(), 1) # Message should contain non-ugly model verbose name. The instance - # representation is set by model's __unicode__() + # representation is set by model's __str__() self.assertContains( response, '
  • The telegram "' @@ -3969,7 +3969,7 @@ class AdminCustomQuerysetTest(TestCase): reverse('admin:admin_views_telegram_change', args=(t.pk,)), html=True ) - # model has no __unicode__ method + # model has no __str__ method p = Paper.objects.create(title="My Paper Title") self.assertEqual(Paper.objects.count(), 1) response = self.client.get(reverse('admin:admin_views_paper_change', args=(p.pk,))) diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py index 173166a754..336ddf3e15 100644 --- a/tests/model_inheritance/tests.py +++ b/tests/model_inheritance/tests.py @@ -19,7 +19,7 @@ from .models import ( class ModelInheritanceTests(TestCase): def test_abstract(self): # The Student and Worker models both have 'name' and 'age' fields on - # them and inherit the __unicode__() method, just as with normal Python + # them and inherit the __str__() method, just as with normal Python # subclassing. This is useful if you want to factor out common # information for programming purposes, but still completely # independent separate models at the database level.