summaryrefslogtreecommitdiff
path: root/tests/str
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-10-13 18:06:58 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-10-13 18:14:04 +0200
commit589dc49e129f63801c54c15e408c944a345b3dfe (patch)
tree620f2db590b7d5ccc7d06dc6bef3e0d8ea05febc /tests/str
parent570d9c2678d6cc564f9c70138554af8f7ce9ec49 (diff)
downloaddjango-589dc49e129f63801c54c15e408c944a345b3dfe.tar.gz
Fixed #21198 -- Prevented invalid use of @python_2_unicode_compatible.
Thanks jpic for the report and chmodas for working on a patch. Reverts 2ea80b94. Refs #19362.
Diffstat (limited to 'tests/str')
-rw-r--r--tests/str/models.py8
-rw-r--r--tests/str/tests.py12
2 files changed, 1 insertions, 19 deletions
diff --git a/tests/str/models.py b/tests/str/models.py
index 1c158ea008..488012e861 100644
--- a/tests/str/models.py
+++ b/tests/str/models.py
@@ -28,14 +28,6 @@ class Article(models.Model):
return self.headline
@python_2_unicode_compatible
-class BrokenArticle(models.Model):
- headline = models.CharField(max_length=100)
- pub_date = models.DateTimeField()
-
- def __unicode__(self): # instead of __str__
- return self.headline
-
-@python_2_unicode_compatible
class InternationalArticle(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
diff --git a/tests/str/tests.py b/tests/str/tests.py
index 3c0bc079c8..aeb2874195 100644
--- a/tests/str/tests.py
+++ b/tests/str/tests.py
@@ -7,7 +7,7 @@ from unittest import skipIf
from django.test import TestCase
from django.utils import six
-from .models import Article, BrokenArticle, InternationalArticle
+from .models import Article, InternationalArticle
class SimpleTests(TestCase):
@@ -21,16 +21,6 @@ class SimpleTests(TestCase):
self.assertEqual(str(a), str('Area man programs in Python'))
self.assertEqual(repr(a), str('<Article: Area man programs in Python>'))
- @skipIf(six.PY3, "tests Model's default __str__ method under Python 2")
- def test_broken(self):
- # Regression test for #19362.
- a = BrokenArticle.objects.create(
- headline='Girl wins €12.500 in lottery',
- pub_date=datetime.datetime(2005, 7, 28)
- )
- six.assertRaisesRegex(self, RuntimeError, "Did you apply "
- "@python_2_unicode_compatible without defining __str__\?", str, a)
-
def test_international(self):
a = InternationalArticle.objects.create(
headline='Girl wins €12.500 in lottery',