-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support passed integers #9
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seddonym
commented
Sep 24, 2024
tests/test_python_interface.py
Outdated
@pytest.mark.parametrize( | ||
"number, expected", | ||
( | ||
pytest.param(1, "One", marks=pytest.mark.xfail), |
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.
The fact that this fails is the main reason for this PR.
seddonym
commented
Sep 24, 2024
(2, "Something else"), | ||
# Note that for selection to work, the variable must be an integer. | ||
# So "1" is not equivalent to 1. | ||
("1", "Something else"), |
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.
Note this behaviour is consistent with Django FTL and Fluent Playground.
4acece4
to
170c641
Compare
99e8288
to
e71fb7d
Compare
Only certain values can be passed, see https://docs.rs/fluent/latest/fluent/enum.FluentValue.html. But we narrow down even further for the time being.
Pointed out by cargo clippy
e71fb7d
to
ec79565
Compare
dooferlad
approved these changes
Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where integers passed as selectors wouldn't get selected correctly. This was because we were calling
to_string()
on everything before passing it to the message.To make this simpler to tackle, we stop supporting all objects being passed in as variables, and just support integers and strings for now. (I did attempt floats as well, but it turned into a bit of a rabbit hole, and since we don't seem to use them at the moment, I backed this out.)