Note that Locale.parse() does not accept None#978
Conversation
Codecov Report
@@ Coverage Diff @@
## master #978 +/- ##
==========================================
+ Coverage 90.91% 90.94% +0.02%
==========================================
Files 25 25
Lines 4350 4350
==========================================
+ Hits 3955 3956 +1
+ Misses 395 394 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
babel/core.py
Outdated
| def parse( | ||
| cls, | ||
| identifier: str | Locale | None, | ||
| identifier: str | Locale, |
There was a problem hiding this comment.
It's a bit complicated here since all the LC_... constants could be None if there is a problem determining the default and they are potentially passed to this method, meaning for type checkers, it sees this function as accepting None, but always raising the exception here.
Effectively, the input hasn't changed, but now in the case where there's no default, a TypeError will occur instead of an AttributeError later on.
There was a problem hiding this comment.
Great points, thanks! Updated the approach here to docs-only.
Refs #977