Skip to content

Added fromisoformat() to date and datetime #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 19, 2021

Conversation

makermelissa
Copy link
Collaborator

@makermelissa makermelissa commented Feb 18, 2021

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

@makermelissa makermelissa requested a review from a team February 18, 2021 18:04
@brentru
Copy link
Member

brentru commented Feb 18, 2021

@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
Copy link
Collaborator Author

Sure thing @brentru

@brentru brentru self-requested a review February 18, 2021 18:50
@makermelissa
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

@makermelissa
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makermelissa this looks good to me! Thanks for adding the unittests.

@makermelissa makermelissa merged commit 99f35da into adafruit:master Feb 19, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 20, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_datetime to 1.1.0 from 1.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#2 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.14.0 from 2.12.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#120 from jposada202020/bitmap_label_base_alignment
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#115 from jposada202020/base_alignement_proposal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants