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:
parent
474bd8648b
commit
60e38d29ca
|
@ -1,30 +1,18 @@
|
||||||
"""
|
from django.test import TestCase
|
||||||
>>> from django.utils.tzinfo import FixedOffset
|
|
||||||
|
|
||||||
>>> FixedOffset(0)
|
from django.utils.tzinfo import FixedOffset
|
||||||
+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
|
|
||||||
"""
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
class TzinfoTests(TestCase):
|
||||||
import doctest
|
|
||||||
doctest.testmod()
|
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')
|
||||||
|
|
Loading…
Reference in New Issue