This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sobolevn
Recipients gvanrossum, kj, sobolevn
Date 2022-01-26.08:39:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643186348.67.0.481698382701.issue46529@roundup.psfhosted.org>
In-reply-to
Content
There are several important cases that are missing from current `repr()` tests of `typing.Union` and `typing.Optional`:
1. This condition is not covered at all: `if args[0] is type(None):` https://github.com/python/cpython/blob/7cf285d82ec722d4225297366013e924805171f2/Lib/typing.py#L1236
3. `repr()` of `Union[str, None]` is not directly tested as well
3. `repr()` of `Union` with more that 2 parameters with `None` is not covered. This is an important corner case because of this condition: `if len(args) == 2:` https://github.com/python/cpython/blob/7cf285d82ec722d4225297366013e924805171f2/Lib/typing.py#L1235

I will send a PR with new assertions.
History
Date User Action Args
2022-01-26 08:39:08sobolevnsetrecipients: + sobolevn, gvanrossum, kj
2022-01-26 08:39:08sobolevnsetmessageid: <1643186348.67.0.481698382701.issue46529@roundup.psfhosted.org>
2022-01-26 08:39:08sobolevnlinkissue46529 messages
2022-01-26 08:39:08sobolevncreate