File: test_lib_cdate.py

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (39 lines) | stat: -rw-r--r-- 1,087 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import unittest
from unittests import wtc
import wx.lib.CDate as cdate
import six


class lib_cdate_Tests(wtc.WidgetTestCase):

    def test_lib_cdate_DateCtor(self):
        cdate.Date(2014, 1, 31)

    def test_lib_cdate_NowCtor(self):
        cdate.now()

    def test_lib_cdate_IsleapTrue(self):
        l1 = cdate.isleap(2012)
        self.assertTrue(l1, msg='Expected a leap year')

    def test_lib_cdate_IsleapFalse(self):
        l2 = cdate.isleap(2013)
        self.assertFalse(l2, msg='Expected a non leap year')

    def test_lib_cdate_Julianday(self):
        bd = cdate.Date(2014, 1, 10)
        jd = cdate.julianDay(bd.year, bd.month, bd.day)

        self.assertTrue(jd == bd.julian,
                        msg='Expected them to be equal')

    def test_lib_cdate_Dayofweek(self):
        jd = cdate.julianDay(2014, 1, 10)
        dw = cdate.dayOfWeek(jd)
        self.assertTrue(dw == 4, msg='Expected "4" assuming Monday is 1, got %s' % dw)

#---------------------------------------------------------------------------


if __name__ == '__main__':
    unittest.main()