[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread Nikita Sobolev


New submission from Nikita Sobolev :

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.

--
components: Tests
messages: 411715
nosy: gvanrossum, kj, sobolevn
priority: normal
severity: normal
status: open
title: Improve test coverage of `Union` and `Optional` repr()
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
pull_requests: +29090
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30911

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread Ken Jin


Ken Jin  added the comment:


New changeset d0c690b5f85c679de6059cf353fe0524e905530e by Nikita Sobolev in 
branch 'main':
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911)
https://github.com/python/cpython/commit/d0c690b5f85c679de6059cf353fe0524e905530e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29099
pull_request: https://github.com/python/cpython/pull/30920

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread miss-islington


miss-islington  added the comment:


New changeset c730342005edf67333c37b575b419e2fc67d232b by Miss Islington (bot) 
in branch '3.10':
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911)
https://github.com/python/cpython/commit/c730342005edf67333c37b575b419e2fc67d232b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread miss-islington


miss-islington  added the comment:


New changeset 29eefcc9c688bc4097f2660de1fa846c5ea54735 by Miss Islington (bot) 
in branch '3.9':
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911)
https://github.com/python/cpython/commit/29eefcc9c688bc4097f2660de1fa846c5ea54735


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46529] Improve test coverage of `Union` and `Optional` repr()

2022-01-26 Thread Ken Jin


Change by Ken Jin :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com