Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Migrated tzinfo doctests. Thanks to Stephan Jaekel.

Backport of r13887 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1917a43c4b6f4f310ec63dcb55927ddcd0132f4d 1 parent 46448ec
@freakboy3742 freakboy3742 authored
Showing with 16 additions and 28 deletions.
  1. +16 −28 tests/regressiontests/utils/tzinfo.py
View
44 tests/regressiontests/utils/tzinfo.py
@@ -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')

0 comments on commit 1917a43

Please sign in to comment.
Something went wrong with that request. Please try again.