Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.1.X] Made a few Python 2.3 compatibility test fixes.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9b2ac2ad2d7f17e65da1a3e719f3da5962923cfd 1 parent 1adc88f
@kmtracey kmtracey authored
View
14 tests/modeltests/field_subclassing/tests.py
@@ -6,16 +6,16 @@
class CustomField(TestCase):
def test_defer(self):
d = DataModel.objects.create(data=[1, 2, 3])
-
- self.assertTrue(isinstance(d.data, list))
-
+
+ self.failUnless(isinstance(d.data, list))
+
d = DataModel.objects.get(pk=d.pk)
- self.assertTrue(isinstance(d.data, list))
+ self.failUnless(isinstance(d.data, list))
self.assertEqual(d.data, [1, 2, 3])
-
+
d = DataModel.objects.defer("data").get(pk=d.pk)
d.save()
-
+
d = DataModel.objects.get(pk=d.pk)
- self.assertTrue(isinstance(d.data, list))
+ self.failUnless(isinstance(d.data, list))
self.assertEqual(d.data, [1, 2, 3])
View
8 tests/regressiontests/mail/tests.py
@@ -112,8 +112,8 @@
>>> email.encoding = 'iso-8859-1'
>>> email.message()['To']
'=?iso-8859-1?q?S=FCrname=2C_Firstname?= <to@example.com>, other@example.com'
->>> email.message()['Subject'].encode()
-u'=?iso-8859-1?q?Message_from_Firstname_S=FCrname?='
+>>> email.message()['Subject'].encode() == u'=?iso-8859-1?q?Message_from_Firstname_S=FCrname?='
+True
# Make sure headers can be set with a different encoding than utf-8 in SafeMIMEMultipart as well
>>> headers = {"Date": "Fri, 09 Nov 2001 01:08:47 -0000", "Message-ID": "foo"}
@@ -125,8 +125,8 @@
>>> msg.encoding = 'iso-8859-1'
>>> msg.message()['To']
'=?iso-8859-1?q?S=FCrname=2C_Firstname?= <to@example.com>'
->>> msg.message()['Subject'].encode()
-u'=?iso-8859-1?q?Message_from_Firstname_S=FCrname?='
+>>> msg.message()['Subject'].encode() == u'=?iso-8859-1?q?Message_from_Firstname_S=FCrname?='
+True
# Regression for #12791 - Encode body correctly with other encodings than utf-8
>>> email = EmailMessage('Subject', 'Firstname Sürname is a great guy.', 'from@example.com', ['other@example.com'])
View
8 tests/regressiontests/model_fields/tests.py
@@ -35,10 +35,10 @@ def test_show_hidden_initial(self):
choices = [(0, 0), (1, 1)]
model_field = models.Field(choices=choices)
form_field = model_field.formfield(show_hidden_initial=True)
- self.assertTrue(form_field.show_hidden_initial)
+ self.failUnless(form_field.show_hidden_initial)
form_field = model_field.formfield(show_hidden_initial=False)
- self.assertFalse(form_field.show_hidden_initial)
+ self.failIf(form_field.show_hidden_initial)
class DecimalFieldTests(django.test.TestCase):
def test_to_python(self):
@@ -168,7 +168,7 @@ class TypeCoercionTests(django.test.TestCase):
"""
def test_lookup_integer_in_charfield(self):
self.assertEquals(Post.objects.filter(title=9).count(), 0)
-
+
def test_lookup_integer_in_textfield(self):
self.assertEquals(Post.objects.filter(body=24).count(), 0)
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.