~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlprofile/tests.py

  • Committer: franku
  • Date: 2019-04-11 15:06:09 UTC
  • mto: This revision was merged to the branch mainline in revision 540.
  • Revision ID: somal@arcor.de-20190411150609-801l72ffxgr6gkui
converted to python 3.6 using 2to3 script

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import unittest
4
4
import datetime
5
5
 
6
 
from templatetags.custom_date import do_custom_date
 
6
from .templatetags.custom_date import do_custom_date
7
7
 
8
8
 
9
9
class _CustomDate_Base(unittest.TestCase):
70
70
class TestCustomDate_NaturalDayReplacementYesterday_ExceptCorrectResult(_CustomDate_Base):
71
71
 
72
72
    def runTest(self):
73
 
        now = datetime.datetime(2008, 4, 13, 00, 00, 01)
 
73
        now = datetime.datetime(2008, 4, 13, 00, 00, 0o1)
74
74
        rv = do_custom_date('j.m.y: %ND(j.m.y)', self.date, 0, now)
75
75
        self.assertEqual('12.04.08: yesterday', rv)
76
76
 
78
78
class TestCustomDate_NaturalDayReplacementNoSpecialDay_ExceptCorrectResult(_CustomDate_Base):
79
79
 
80
80
    def runTest(self):
81
 
        now = datetime.datetime(2011, 4, 13, 00, 00, 01)
 
81
        now = datetime.datetime(2011, 4, 13, 00, 00, 0o1)
82
82
        rv = do_custom_date('j.m.y: %ND(j.m.Y)', self.date, 0, now)
83
83
        self.assertEqual('12.04.08: 12.04.2008', rv)
84
84
 
86
86
class TestCustomDate_RecursiveReplacementNoHit_ExceptCorrectResult(_CustomDate_Base):
87
87
 
88
88
    def runTest(self):
89
 
        now = datetime.datetime(2011, 4, 13, 00, 00, 01)
 
89
        now = datetime.datetime(2011, 4, 13, 00, 00, 0o1)
90
90
        rv = do_custom_date('j.m.y%ND(: j.m%NY(.Y))', self.date, 0, now)
91
91
        self.assertEqual('12.04.08: 12.04.2008', rv)
92
92
 
94
94
class TestCustomDate_RecursiveReplacementMissDayHitYear_ExceptCorrectResult(_CustomDate_Base):
95
95
 
96
96
    def runTest(self):
97
 
        now = datetime.datetime(2008, 9, 13, 00, 00, 01)
 
97
        now = datetime.datetime(2008, 9, 13, 00, 00, 0o1)
98
98
        rv = do_custom_date('j.m.y: %ND(j.m.%NY(Y))', self.date, 0, now)
99
99
        self.assertEqual('12.04.08: 12.04.', rv)
100
100
 
102
102
class TestCustomDate_RecursiveReplacementHitDayTodayHitYear_ExceptCorrectResult(_CustomDate_Base):
103
103
 
104
104
    def runTest(self):
105
 
        now = datetime.datetime(2008, 4, 12, 00, 00, 01)
 
105
        now = datetime.datetime(2008, 4, 12, 00, 00, 0o1)
106
106
        rv = do_custom_date('j.m.y: %ND(j.m.%NY(Y))', self.date, 0, now)
107
107
        self.assertEqual('12.04.08: today', rv)
108
108