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

Prioritize numbers next to currencies #5

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

Conversation

Gallaecio
Copy link
Member

@Gallaecio Gallaecio commented May 16, 2019

Fixes #2, fixes #47

Notes:

  • I’m not proud of the readability of the changes, so I would really welcome any architecture/aesthetic feedback.
  • What should be done with extract_currency_symbol? Remove, deprecate or keep? It is the current responsible for the coverage drop; if it’s going to stay I should provide tests for it.
  • As a side effect of these changes, "From 26 to 50 €" gives 50 instead of 26. Prioritizing the lowest side of a human-readable number range seems worth its own patch, so I changed the test expectations.

@Gallaecio Gallaecio force-pushed the price-next-to-currency branch 2 times, most recently from 8304135 to 42a3bcf Compare May 22, 2019 09:35
@codecov
Copy link

codecov bot commented May 22, 2019

Codecov Report

Merging #5 (3fe0965) into master (82c27a8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master        #5   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           98       113   +15     
  Branches        21        26    +5     
=========================================
+ Hits            98       113   +15     
Impacted Files Coverage Δ
price_parser/parser.py 100.00% <100.00%> (ø)
price_parser/_currencies.py 100.00% <0.00%> (ø)

tests/test_price_parsing.py Outdated Show resolved Hide resolved
price_parser/parser.py Outdated Show resolved Hide resolved
price_parser/parser.py Outdated Show resolved Hide resolved
price_parser/parser.py Outdated Show resolved Hide resolved
@kmike
Copy link
Member

kmike commented Jun 12, 2019

Thanks @Gallaecio! I think the approach you've chosen to fix it makes sense.

What should be done with extract_currency_symbol?

I think it is better to keep it. It can be rather easy to test, as existing pytest.mark.parametrize test cases contain currency.

As a side effect of these changes, "From 26 to 50 €" gives 50 instead of 26. Prioritizing the lowest side of a human-readable number range seems worth its own patch, so I changed the test expectations.

This sounds fine; such strings is what we see in practice, but not what should necessarily be passed to price-parser.

@Gallaecio Gallaecio changed the title Prioritize numbers next to currencies [WIP] Prioritize numbers next to currencies Jun 19, 2019
@Gallaecio Gallaecio changed the title [WIP] Prioritize numbers next to currencies Prioritize numbers next to currencies Jun 19, 2019
@Gallaecio
Copy link
Member Author

Suggestions applied, along with:

  • Tests for extract_currency_symbol keeping current test coverage.
  • Tests for the new feature which I had written locally but forgot to commit.
  • Comments describing the missing features causing two of the expected failures.

@Gallaecio Gallaecio changed the title Prioritize numbers next to currencies [WIP] Prioritize numbers next to currencies Jun 24, 2019
@Gallaecio Gallaecio changed the title [WIP] Prioritize numbers next to currencies Prioritize numbers next to currencies Jun 24, 2019
@676339784
Copy link

Is this branch still up to date? I'm having the same issue as #47, but it seems that this PR could fix it?

@Gallaecio
Copy link
Member Author

It is not up to date, I need to update it and solve the merge conflicts.

@676339784
Copy link

Sounds good! Would it be ready for merging afterwards? Not too familiar with how the whole review process works. Thank you

@Gallaecio
Copy link
Member Author

A maintainer, maybe 2, need to approve the changes.

@676339784
Copy link

Awesome.

@kmike Seems like this PR has been in limbo for a while now. Assuming you are a maintainer, does this PR look good to you if it's updated and solved merge conflicts?

@Gallaecio
Copy link
Member Author

Gallaecio commented Feb 11, 2021

@kmike is a maintainer in a lot of projects. Waiting for me to update the pull request and then reviewing it will probably be a better use of his time 🙂

I have a few things I need to prioritize myself before I have time to update this. I hope to handle it sometime next week, but I cannot make any promise.

@676339784
Copy link

@kmike is a maintainer in a lot of projects. Waiting for me to update the pull request and then reviewing it will probably be a better use of his time 🙂

Great point.

I hope to handle it sometime next week, but I cannot make any promise.

Thank you! I can also separately attempt bringing this branch up to date and whatnot, but that might not be very fruitful

@676339784
Copy link

I saw that you've rebased the branch, are there any procedures I can help with before it gets reviewed? Or if I should ping any maintainers?

@Gallaecio
Copy link
Member Author

There’s nothing else you can do on your side, just patience. When a maintainer has time, it will be reviewed.

@676339784
Copy link

Sounds good. Was just wondering since this has been open for almost two years now. Thank you for fixing!

@Gallaecio Gallaecio requested a review from kmike April 5, 2021 11:39
@kmike kmike requested a review from lopuhin April 5, 2021 19:35
@lopuhin
Copy link
Member

lopuhin commented Apr 6, 2021

Thanks for the PR @Gallaecio , I had a quick look before, and should be able to do the full review early next week.

Copy link

@Hattorius Hattorius left a comment

Choose a reason for hiding this comment

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

yes

@argaurav
Copy link

This PR would help us a lot, Can we do anything to get this through?

@lopuhin
Copy link
Member

lopuhin commented Sep 27, 2023

Hey, thanks for feedback, we'll prioritize this, now we have a much better test suite in master.

@evrial
Copy link

evrial commented May 12, 2024

In [5]: parse_price("30 options from $299.00")
Out[5]: Price(amount=Decimal('30'), currency='$')

I wish this merged sooner

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.

Prefer price number which is close to currency symbol Incorrect parsing
7 participants