-
Notifications
You must be signed in to change notification settings - Fork 6
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
✨ Add flexible currency parser with validation and symbol detection for Pydantic models #86
base: main
Are you sure you want to change the base?
Conversation
) | ||
def test_flexible_price_success(input_value, expected_output): | ||
model = _TestModel(value=input_value) | ||
assert model.value == pytest.approx(expected_output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we doing approx? Whats the limit here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i usually do this when comparing floats to avoid any unexpected percision issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a full schema parsing test by adding a mock schema in core/test/parser/mock_schemas that uses both currency and price. We need to validate the case when currency is all null
…ce_not_available_phrases.
CurrencyParser
to parse and validate currency inputs, detecting symbols and converting them to standardized currency codes.ParserTypeCurrency
usingAnnotated
andBeforeValidator
for seamless integration with Pydantic models, returning structured dictionaries.