Fix font weight validation#15271
Conversation
There was a problem hiding this comment.
This should definitely get a simple smoke test
29b6780 to
56c53a1
Compare
56c53a1 to
337c0b9
Compare
337c0b9 to
18cecf7
Compare
|
I actually changed the implementation to only accept a defined list of strings and trying to convert everything else to int. This allows the validator to fail early on invalid strings like "noweight". - Previously, the code using the weight would have failed on that. The implementation uses a fixed list of strings. That is not too nice, because it duplicates ping @dstansby Tests added. |
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
…v3.1.x Backport PR #15271 on branch v3.1.x (Fix font weight validation)
…271-on-v3.2.x Backport PR #15271 on branch v3.2.x (Fix font weight validation)
| try: | ||
| return int(s) | ||
| except (ValueError, TypeError): | ||
| raise ValueError(f'{s} is not a valid font weight. %s') |
There was a problem hiding this comment.
Err, hold one, were both these s's in here?
PR Summary
Fixes #15240. Solution taken from #15240 (comment).