-
-
Notifications
You must be signed in to change notification settings - Fork 12
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 likely_subtags: data generation, node executor #93
Conversation
This uses the latest CLDR data in https://github.com/unicode-org/cldr/blob/main/common/testData/localeIdentifiers/likelySubtags.txt for checking Node's minimize and maximize locale tags. |
testgen/testdata_gen.py
Outdated
# Create 3 minimize tests | ||
expected = tags[2] |
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.
Suggestion: you should read tags[3]
and put it in an option called minimizeFavorScript
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.
Thanks. Will do!
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.
Done!
testgen/testdata_gen.py
Outdated
verify = {'label': label, | ||
'verify': expected | ||
} |
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 note the highlighted portions of the notice at the top of the test data file:
Source ; AddLikely ; RemoveFavorScript ; RemoveFavorRegion
Source: a locale to which the following operations are applied.
AddLikely: the result of the Add Likely Subtags.
If Add Likely Subtags fails, then “FAIL”.
RemoveFavorScript: Remove Likely Subtags, when the script is favored.
Only included when different than AddLikely.
RemoveFavorRegion: Remove Likely Subtags, when the region is favored.
Only included when different than RemoveFavorScript.
I don't immediately see where you are doing the "only included when..." portion of the instructions. Most but not all cases have data populated for RemoveFavorScript, and only a few have data populated for RemoveFavorRegion
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.
Updated tests and code in latest commits.
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.
Updated to handle non-included values, falling back to previous.
if line.find('FAIL') >= 0: | ||
# What do do with this? | ||
pass | ||
|
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.
Feel free to ignore this comment.
Right now you have:
{ label: "123", verify: "en-Latn-US" }
The expected could be like:
{ label: "123", verify: { locale: "en-Latn-US" } }
Instead it could be:
{ label: "123", verify: { error: true } }
Or, you just output the string "FAIL" from the executor.
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.
Removed this, using "FAIL" as if it's expected data.
test_option === 'minimize') { | ||
result_locale = intl_locale.minimize().baseName; | ||
} else if (test_option === 'minimizeFavorRegion') { | ||
result_locale = intl_locale.minimizeFavorRegion().baseName; |
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: there is no Intl.Locale.prototype.minizeFavorRegion
; this should be unsupported
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.
Updated now.
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 don't see where this is fixed but OK to fix later
testgen/testdata_gen.py
Outdated
# Create minimize tests - default is RemoveFavorScript | ||
if tags[2]: | ||
remove_favor_script = tags[2] | ||
for tag in tags: |
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.
This generates extra cases for each line. Probably not needed.
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.
Simplified, creating maximum of 3 cases per source locale.
testgen/testdata_gen.py
Outdated
pass | ||
|
||
# Create minimize tests - default is RemoveFavorScript | ||
if tags[2]: |
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.
tags[2]
should inherit from tags[1]
and tags[3]
should inherit from tags[2]
.
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.
Done
Much better now! PTAL |
test_option === 'minimize') { | ||
result_locale = intl_locale.minimize().baseName; | ||
} else if (test_option === 'minimizeFavorRegion') { | ||
result_locale = intl_locale.minimizeFavorRegion().baseName; |
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 don't see where this is fixed but OK to fix later
No description provided.