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:
Robin Dunn
2014-01-14 03:08:53 +00:00
parent 294c3428dc
commit 503913f34c
2 changed files with 38 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
import imp_unittest, unittest
import wtc
import wx
import wx.lib.calendar as cal
#---------------------------------------------------------------------------
class lib_calendar_Tests(wtc.WidgetTestCase):
def test_lib_calendar_CalendarCtor(self):
pnl = wx.Panel(self.frame)
acal = cal.Calendar(pnl)
def test_lib_calendar_CalendarSetDate(self):
pnl = wx.Panel(self.frame)
acal = cal.Calendar(pnl)
acal.SetYear(2014)
acal.SetMonth(1)
acal.SetDayValue(31)
def test_lib_calendar_CalenDlgCtor(self):
dlg = cal.CalenDlg(self.frame, month=1, day=11, year=2014)
dlg.Destroy()
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()

View File

@@ -4,30 +4,30 @@ import wx.lib.CDate as cdate
import wx.lib.six as six
class CdateTests(wtc.WidgetTestCase):
class lib_cdate_Tests(wtc.WidgetTestCase):
def test_CdateDateCtor(self):
def test_lib_cdate_DateCtor(self):
cdate.Date(2014, 1, 31)
def test_CdateNowCtor(self):
def test_lib_cdate_NowCtor(self):
cdate.now()
def test_CdateIsleapTrue(self):
def test_lib_cdate_IsleapTrue(self):
l1 = cdate.isleap(2012)
self.assertTrue(l1, msg='Expected a leap year')
def test_CdateIsleapFalse(self):
def test_lib_cdate_IsleapFalse(self):
l2 = cdate.isleap(2013)
self.assertFalse(l2, msg='Expected a non leap year')
def test_CdateJulianday(self):
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_CdateDayofweek(self):
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)