#921: WebComment: fix February 29th date math problem
------------------------+-----------------
 Reporter:  simko       |      Owner:
     Type:  defect      |     Status:  new
 Priority:  major       |  Milestone:
Component:  WebComment  |    Version:
 Keywords:              |
------------------------+-----------------
 Today, on February 29th (note the date), WebComment unit tests fail for me
 in the maint-1.0 branch:

 {{{
 ======================================================================
 ERROR: test_previous_year
 (invenio.webcomment_tests.TestCalculateStartDate)
 webcomment - calculate_start_date, values bigger than one year
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/dist-
 packages/invenio/webcomment_tests.py", line 32, in test_previous_year
     self.assert_(int(calculate_start_date('1y')[:4]) > 2007)
   File "/usr/local/lib/python2.7/dist-packages/invenio/webcomment.py",
 line 1231, in calculate_start_date
     yesterday = today.replace(year=final_nb_year)
 ValueError: day is out of range for month

 ======================================================================
 ERROR: test_with_random_values
 (invenio.webcomment_tests.TestCalculateStartDate)
 webcomment - calculate_start_date, various random values
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/dist-
 packages/invenio/webcomment_tests.py", line 42, in test_with_random_values
     self.assert_(calculate_start_date('2y') > '2007-07-09 14:50:43')
   File "/usr/local/lib/python2.7/dist-packages/invenio/webcomment.py",
 line 1231, in calculate_start_date
     yesterday = today.replace(year=final_nb_year)
 ValueError: day is out of range for month
 }}}

-- 
Ticket URL: <http://invenio-software.org/ticket/921>
Invenio <http://invenio-software.org>

Reply via email to