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.

classification
Title: Improve coverage of `__instancecheck__` and `__subclasscheck__` methods in `typing.py`
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: AlexWaygood, gvanrossum, kj, serhiy.storchaka, sobolevn
Priority: normal Keywords: patch

Created on 2022-02-02 14:00 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31078 merged sobolevn, 2022-02-02 14:04
PR 31182 merged sobolevn, 2022-02-07 06:40
Messages (4)
msg412361 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-02-02 14:00
There are several problem reported by coverage:
1. This line is never reached in `_SpecialGenericAlias.__subclasscheck__`: https://github.com/python/cpython/blob/08f8301b21648d58d053e1a513db8ed32fbf37dd/Lib/typing.py#L1140
2. `__instancecheck__` and `__subclasscheck__` for `_UnionGenericAlias` are not covered at all: https://github.com/python/cpython/blob/08f8301b21648d58d053e1a513db8ed32fbf37dd/Lib/typing.py#L1243-L1249 I suspect this happened because of `types.UnionType` / `typing.Union` duality

I am going to add these today! 

By the way, this is the last coverage issue in typing! 🎉
msg412701 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2022-02-07 01:35
New changeset 067c03bf40d13393209f0138fa9c4d5980c4ff8a by Nikita Sobolev in branch 'main':
bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078)
https://github.com/python/cpython/commit/067c03bf40d13393209f0138fa9c4d5980c4ff8a
msg412721 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-02-07 08:48
New changeset c1ff4cb98b11c00aee765019364544c71e7dd2df by Nikita Sobolev in branch '3.10':
[3.10] bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078) (GH-31182)
https://github.com/python/cpython/commit/c1ff4cb98b11c00aee765019364544c71e7dd2df
msg412722 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-02-07 08:49
Thanks Nikita.
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90769
2022-02-07 08:49:38serhiy.storchakasetstatus: open -> closed
versions: + Python 3.10
messages: + msg412722

components: + Tests, - Library (Lib)
resolution: fixed
stage: patch review -> resolved
2022-02-07 08:48:42serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg412721
2022-02-07 06:40:20sobolevnsetpull_requests: + pull_request29354
2022-02-07 01:35:55gvanrossumsetmessages: + msg412701
2022-02-02 14:04:41sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29262
2022-02-02 14:01:12sobolevnsetnosy: + gvanrossum, kj, AlexWaygood
2022-02-02 14:00:52sobolevncreate