Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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
Russell Keith-Magee authored September 27, 2010

Showing 1 changed file with 16 additions and 28 deletions. Show diff stats Hide diff stats

  1. 44  tests/regressiontests/utils/tzinfo.py
44  tests/regressiontests/utils/tzinfo.py
... ...
@@ -1,30 +1,18 @@
1  
-"""
2  
->>> from django.utils.tzinfo import FixedOffset
  1
+from django.test import TestCase
3 2
 
4  
->>> FixedOffset(0)
5  
-+0000
6  
->>> FixedOffset(60)
7  
-+0100
8  
->>> FixedOffset(-60)
9  
--0100
10  
->>> FixedOffset(280)
11  
-+0440
12  
->>> FixedOffset(-280)
13  
--0440
14  
->>> FixedOffset(-78.4)
15  
--0118
16  
->>> FixedOffset(78.4)
17  
-+0118
18  
->>> FixedOffset(-5.5*60)
19  
--0530
20  
->>> FixedOffset(5.5*60)
21  
-+0530
22  
->>> FixedOffset(-.5*60)
23  
--0030
24  
->>> FixedOffset(.5*60)
25  
-+0030
26  
-"""
  3
+from django.utils.tzinfo import FixedOffset
27 4
 
28  
-if __name__ == "__main__":
29  
-    import doctest
30  
-    doctest.testmod()
  5
+class TzinfoTests(TestCase):
  6
+
  7
+    def test_fixedoffset(self):
  8
+        self.assertEquals(repr(FixedOffset(0)), '+0000')
  9
+        self.assertEquals(repr(FixedOffset(60)), '+0100')
  10
+        self.assertEquals(repr(FixedOffset(-60)), '-0100')
  11
+        self.assertEquals(repr(FixedOffset(280)), '+0440')
  12
+        self.assertEquals(repr(FixedOffset(-280)), '-0440')
  13
+        self.assertEquals(repr(FixedOffset(-78.4)), '-0118')
  14
+        self.assertEquals(repr(FixedOffset(78.4)), '+0118')
  15
+        self.assertEquals(repr(FixedOffset(-5.5*60)), '-0530')
  16
+        self.assertEquals(repr(FixedOffset(5.5*60)), '+0530')
  17
+        self.assertEquals(repr(FixedOffset(-.5*60)), '-0030')
  18
+        self.assertEquals(repr(FixedOffset(.5*60)), '+0030')

0 notes on commit 1917a43

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