Skip to content
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

Force exact match on .get() #1142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

13MK3
Copy link

@13MK3 13MK3 commented Nov 14, 2022

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

Description of Changes

These changes were made in collaboration with @khanm3

  • Modified the _ONE_OR_TWO_DIGIT_RE regex to not accept numbers with leading zeros. This is done in order to conform to the expected behavior and throw an error when, for example, you try to match '01' with 'M'. The issue force exact match on .get() #1084 only mentions the 'M' token, but realized that the 'D', 'H', 'm', 'h', and 's' have similar behavior which we have also corrected.
  • Modified an existing test case since this test was using the undesired behavior which this pull request is intended to fix
  • Added a test case which checks the expected behavior for all 6 tokens.

Closes: #1084

Questions:

  • We also noticed that the 'DDD' token seems to have similar behavior as well. If you try to match '001' to 'DDD', should that also be expected to fail? We left that one untouched since it uses a different regex and we weren't positive.
  • Unrelated to this pull request, but we noticed that tests/test_arrow.py::TestArrowHumanize::test_months is marked as expected to fail, but before we made any changes, it was already passing. Maybe this should be updated?

Co-Authored by: Lukas Lemke <90070416+13MK3@users.noreply.github.com>
Co-Authored by: Lukas Lemke <90070416+13MK3@users.noreply.github.com>
Co-Authored by: Lukas Lemke <90070416+13MK3@users.noreply.github.com>
@anishnya anishnya requested review from jadchaar, krisfremen and systemcatch and removed request for jadchaar November 14, 2022 20:28
@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (9cfff58) compared to base (74a759b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1142   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         2319      2319           
  Branches       492       492           
=========================================
  Hits          2319      2319           
Impacted Files Coverage Δ
arrow/parser.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@krisfremen krisfremen left a comment

Choose a reason for hiding this comment

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

LGTM for fixing up the link issue.

As far as the 'DDD' token, ISO8601 IIRC specified ordinal numbers that can also have leading zeros. So I think it should be left as is.

TestArrowHumanize::test_months is marked as xfail because we were running into issues with the limits in specific dates/times. it's something we should definitely look again into in the future.

@rodrigondec
Copy link

This PR is awaiting what? 😢

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.

force exact match on .get()
4 participants