On 2/21/06, Benji York <[EMAIL PROTECTED]> wrote:
> Again, not for the average user, bit if the hypothetical six month bug
> were found and those tests were decently written doctests, it would be
> much easier for the maintainer to follow what the test was doing.

Maybe an example can help. Because I don't understand why...

    def testQuarterlyRecurringEvents(self):
        caltool = self.portal.portal_cpscalendar
        mgrcal = caltool.getHomeCalendarObject(manager_id)

        event = Event('quarterly',
                      title="This is a quarterly event",
                      attendees=None,
                      from_date=DateTime(2005, 4, 1, 8, 0),
                      to_date=DateTime(2005, 4, 1, 10, 0),
                      event_type='event_recurring',
                      recurrence_period='period_quarterly')
        mgrcal._setObject('quarterly', event)

        self._upgrade()

        sm = zapi.getUtility(IStorageManager, context=self.portal)
        event = sm.getEvent('quarterly')
        recurrence = event.recurrence
        
self.failUnless(interfaces.IMonthlyRecurrenceRule.providedBy(recurrence))
        self.failUnlessEqual(recurrence.interval, 3)
        self.failUnlessEqual(recurrence.until, None)

...is harder to understand than...

  The migration also handles quarterly recurring events

  >>> caltool = self.portal.portal_cpscalendar
  >>> mgrcal = caltool.getHomeCalendarObject(manager_id)
  >>> event = Event('quarterly',
  ...                    title="This is a quarterly event",
  ...                    attendees=None,
  ...                    from_date=DateTime(2005, 4, 1, 8, 0),
  ...                    to_date=DateTime(2005, 4, 1, 10, 0),
  ...                    event_type='event_recurring',
  ...                    recurrence_period='period_quarterly')
  >>> mgrcal._setObject('quarterly', event)
  >>> if 'install_cpssharedcalendar' not in self.portal.objectIds():
  ...          script = ExternalMethod('install_cpssharedcalendar', '',
  ...                                  'CPSSharedCalendar.install',
  ...                                  'install')
  >>> self.portal._setObject('install_cpssharedcalendar', script)
  >>> script = self.portal['install_cpssharedcalendar']
  >>> script()
  >>> transaction.commit()
  >>> if 'migrate_cpscalendar' not in self.portal.objectIds():
  ...      script = ExternalMethod('migrate_cpscalendar', '',
  ...                                  'CPSSharedCalendar.upgrade',
  ...                                  'migrate_from_cpscalendar')
  >>> self.portal._setObject('migrate_cpscalendar', script)
  >>> script = self.portal['migrate_cpscalendar']
  >>> script()
  >>> sm = zapi.getUtility(IStorageManager, context=self.portal)
  >>> event = sm.getEvent('quarterly')
  >>> recurrence = event.recurrence
  >>> interfaces.IMonthlyRecurrenceRule.providedBy(recurrence)
  True
  >>> recurrence.interval
  3
  >>> recurrence.until
  None

...for a maintainer. I also completely fail to see how the latter
format gives anybody any extra insight, or how this provides any sort
of documentation.

(btw, through all this, I assume that Jims fix for the doctest
debugging problem that he mentioned did work, and that you now can
insert an import pdb;pdb.set_trace() in the middle of the doctests.
Right?)

--
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to