Ticket #10979: 10979-utils_tzinfo-r10651.patch
File 10979-utils_tzinfo-r10651.patch, 2.0 KB (added by , 16 years ago) |
---|
-
django/utils/tzinfo.py
20 20 else: 21 21 self.__offset = timedelta(minutes=offset) 22 22 23 self.__name = u"%+03d%02d" % (offset / 60, offset % 60) 23 sign = offset < 0 and '-' or '+' 24 self.__name = u"%s%02d%02d" % (sign, abs(offset) / 60., abs(offset) % 60) 24 25 25 26 def __repr__(self): 26 27 return self.__name -
tests/regressiontests/utils/tests.py
9 9 import timesince 10 10 import datastructures 11 11 import itercompat 12 import tzinfo 12 13 from decorators import DecoratorFromMiddlewareTests 13 14 14 15 # We need this because "datastructures" uses sorted() and the tests are run in … … 23 24 'timesince': timesince, 24 25 'datastructures': datastructures, 25 26 'itercompat': itercompat, 27 'tzinfo': tzinfo, 26 28 } 27 29 28 30 class TestUtilsHtml(TestCase): -
tests/regressiontests/utils/tzinfo.py
1 """ 2 >>> from django.utils.tzinfo import FixedOffset 3 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 """ 27 28 if __name__ == "__main__": 29 import doctest 30 doctest.testmod()