Pre-Pre-PEP: The datetime.timedeltacal class

Peter J. Holzer hjp-python at hjp.at
Mon Apr 18 07:58:31 EDT 2022


On 2022-04-16 20:25:45 +0100, Barry wrote:
> Suggest that you start with the use cases that you want supported.
> Then you can turn them into a set of tests to check that the solution works.

Writing test cases is always a good idea :-)

I have now written a first set of test cases:
https://git.hjp.at:3000/hjp/timedeltacal
(together with a quick and dirty implementation that passes them).

That's not complete yet.

If covers addition of timezone aware datetime values and timedeltacal
values fairly well, and also tests the t0 + (t1 - t0) == t1 property I
alluded to elsewhere in this thread.

It doesn't test canonicalization yet (and indeed the prototype
implementation is a mess in this regard) and subtracting timedeltacals
from datetimes is also still missing.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20220418/3ac53c13/attachment.sig>


More information about the Python-list mailing list