Migrated tzinfo doctests. Thanks to Stephan Jaekel.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-09-27 15:14:06 +00:00
parent 474bd8648b
commit 60e38d29ca
1 changed files with 16 additions and 28 deletions

View File

@ -1,30 +1,18 @@
"""
>>> from django.utils.tzinfo import FixedOffset
from django.test import TestCase
>>> FixedOffset(0)
+0000
>>> FixedOffset(60)
+0100
>>> FixedOffset(-60)
-0100
>>> FixedOffset(280)
+0440
>>> FixedOffset(-280)
-0440
>>> FixedOffset(-78.4)
-0118
>>> FixedOffset(78.4)
+0118
>>> FixedOffset(-5.5*60)
-0530
>>> FixedOffset(5.5*60)
+0530
>>> FixedOffset(-.5*60)
-0030
>>> FixedOffset(.5*60)
+0030
"""
from django.utils.tzinfo import FixedOffset
if __name__ == "__main__":
import doctest
doctest.testmod()
class TzinfoTests(TestCase):
def test_fixedoffset(self):
self.assertEquals(repr(FixedOffset(0)), '+0000')
self.assertEquals(repr(FixedOffset(60)), '+0100')
self.assertEquals(repr(FixedOffset(-60)), '-0100')
self.assertEquals(repr(FixedOffset(280)), '+0440')
self.assertEquals(repr(FixedOffset(-280)), '-0440')
self.assertEquals(repr(FixedOffset(-78.4)), '-0118')
self.assertEquals(repr(FixedOffset(78.4)), '+0118')
self.assertEquals(repr(FixedOffset(-5.5*60)), '-0530')
self.assertEquals(repr(FixedOffset(5.5*60)), '+0530')
self.assertEquals(repr(FixedOffset(-.5*60)), '-0030')
self.assertEquals(repr(FixedOffset(.5*60)), '+0030')