Pre-Pre-PEP: The datetime.timedeltacal class

Barry barry at barrys-emacs.org
Mon Apr 18 09:47:40 EDT 2022



> On 18 Apr 2022, at 13:01, Peter J. Holzer <hjp-python at hjp.at> wrote:
> 
> 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 :-)

Did you write the use cases? Without them how can anyone review the tests?

Barry

> 
> 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!"
> -- 
> https://mail.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list