[New-bugs-announce] [issue46685] Add additional tests for new features in `typing.py`

Nikita Sobolev report at bugs.python.org
Tue Feb 8 15:03:46 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

New features (like `Self` type and `Never` type), in my opinion, require some extra testing.

Things that were not covered:
- Inheritance from `Self`, only `type(Self)` is covered: https://github.com/python/cpython/blob/c018d3037b5b62e6d48d5985d1a37b91762fbffb/Lib/test/test_typing.py#L193-L196
- Equality and non-equality for `Self` and `Never`. We should be sure that `NoReturn` is not equal to `Never`, but they are equal to themselfs
- `get_type_hints` with `Never`
- `get_origin` with `Self` and `Never` types, it should return `None` for both cases
- (not exactly related) I've also noticed that this line is not covered at all: https://github.com/python/cpython/blob/c018d3037b5b62e6d48d5985d1a37b91762fbffb/Lib/typing.py#L725

Maybe there are some other cases? 

I will send a PR :)

----------
components: Tests
messages: 412865
nosy: AlexWaygood, Jelle Zijlstra, gvanrossum, kj, sobolevn
priority: normal
severity: normal
status: open
title: Add additional tests for new features in `typing.py`
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46685>
_______________________________________


More information about the New-bugs-announce mailing list