francois.girault at clarisys.fr
Thu Jan 15 09:55:29 CET 2004
> Hmm, what you may want to do is write a series of unit tests that
> demonstrate the behavior you expect. For instance, what do you expect
> this to be:
> Date(1999, 1, 31) + RelativeDateTime(months=+1)
> Or maybe you want to say:
> Date(1999, 1, 31) + RelativeDateTime(absoluteMonths=+1)
> where absoluteMonths is always 30?
Great idea. I'll do unit tests to show what I expect
> You see--it's not at all obvious (at least to me), what you expect. A
> series of tests would be half the battle. <wink>
I agree that it's not at all obvious (or I won't post there).
I omitted to tell about the full context of my need : it's related to
postgresql database and the module pypgsql. I've made a patch to pypgsql
project (pypgsql.sf.net) in order to map postgres interval type to
RelativeDateTime instead of DateTimeDelta because several calculation
I've posted this patch to pypgsql user mailing list, and it seems that
I'm not the only one that need correct calculation with interval of
time. Karsten Hilbert from GnuMed project said : "I support inclusion of
the patch. Had the same problem when calculating due/overdue
vaccinations for GnuMed."
So the behavior we expect is the same than postgresql with interval
type. IMHO, postgresql (ie SQL99 interval type) has a very logical point
of view about this non obvious problem. What do you think about that ?
I'm ok to write unit test about that if needed, tell me if it is
Clarisys Informatique - http://www.clarisys.fr
More information about the egenix-users