From 503913f34cd63c80020b47c0de491d3edec4d0dc Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 14 Jan 2014 03:08:53 +0000 Subject: [PATCH] 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 --- unittests/test_lib_calendar.py | 31 +++++++++++++++++++ .../{test_cdate.py => test_lib_cdate.py} | 14 ++++----- 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 unittests/test_lib_calendar.py rename unittests/{test_cdate.py => test_lib_cdate.py} (74%) diff --git a/unittests/test_lib_calendar.py b/unittests/test_lib_calendar.py new file mode 100644 index 00000000..e99ee343 --- /dev/null +++ b/unittests/test_lib_calendar.py @@ -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() diff --git a/unittests/test_cdate.py b/unittests/test_lib_cdate.py similarity index 74% rename from unittests/test_cdate.py rename to unittests/test_lib_cdate.py index caa071a3..52a778e4 100644 --- a/unittests/test_cdate.py +++ b/unittests/test_lib_cdate.py @@ -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)