From 60e38d29ca37d3752c4d537811af5cbf6a8ab3af Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 27 Sep 2010 15:14:06 +0000 Subject: [PATCH] Migrated tzinfo doctests. Thanks to Stephan Jaekel. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13887 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/utils/tzinfo.py | 44 ++++++++++----------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/tests/regressiontests/utils/tzinfo.py b/tests/regressiontests/utils/tzinfo.py index b62570c2253..60fc0b942e3 100644 --- a/tests/regressiontests/utils/tzinfo.py +++ b/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')