mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 11:00:07 +01:00
PR 48: CDate and Calendar unittest
- comply with file naming convention - comply with class and method naming convention - basic tests for lib.calendar git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
39
unittests/test_lib_cdate.py
Normal file
39
unittests/test_lib_cdate.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx.lib.CDate as cdate
|
||||
import wx.lib.six as 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()
|
||||
Reference in New Issue
Block a user