adafruit / Adafruit_CircuitPython_datetime

Basic date and time types. Implements a subset of the CPython datetime module.
MIT License
4 stars 9 forks source link

Added fromisoformat() to date and datetime #2

Closed makermelissa closed 3 years ago

makermelissa commented 3 years ago

Unfortunately CircuitPython doesn't yet support Counted Repetitions or Non-Capturing groups, so the regex is on the longer side.

brentru commented 3 years ago

@makermelissa This looks like an elegant solution to the fromisoformat call in CPython.

Could you add the test for fromisoformat to our tests for this library?

The CPython source is here, https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py#L1812

makermelissa commented 3 years ago

Sure thing @brentru

makermelissa commented 3 years ago

Update: once I started trying out the unit tests, I realized I hadn't implemented this properly with it defaulting to zeroes rather than raising ValueErrors on a bad format. Also, my implementation wasn't complete, so I'm reworking it and doing a proper implementation and that's coming along nicely.

makermelissa commented 3 years ago

There are more unit tests that are not quite passing, but at least some of them have been enabled/added.

makermelissa commented 3 years ago

They can be worked on and improved at a later date, but this PR provides the core functionality that I needed and is ready for review.

makermelissa commented 3 years ago

At this point most of the unit tests that don't pass are due to other functions not being implemented. I updated some of the skip message to reflect this better.