1
0
mirror of https://github.com/django/django.git synced 2025-07-05 10:19:20 +00:00

[soc2010/test-refactor] Updated field_defaults to use unittest2 delta arg for assertAlmostEqual

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Paul McMillan 2010-07-02 18:06:24 +00:00
parent dfd3da2853
commit 9d69c8f01d

View File

@ -1,5 +1,5 @@
# coding: utf-8
from datetime import datetime
from datetime import datetime, timedelta
from django.test import TestCase
from django.utils.safestring import SafeUnicode, SafeString
@ -29,9 +29,7 @@ class FieldDefaultsTestCase(TestCase):
self.assertEqual(a.headline, u'Default headline')
# make sure the two dates are sufficiently close
#fixme, use the new unittest2 function
d = now - a.pub_date
self.assertTrue(d.seconds < 5)
self.assertAlmostEqual(now, a.pub_date, delta=timedelta(5))
# make sure that SafeString/SafeUnicode fields work
a.headline = SafeUnicode(u'Iñtërnâtiônàlizætiøn1')