[New-bugs-announce] [issue46413] `__or__` is not covered for `_GenericAlias` and `_SpecialGenericAlias` in `typing`

Nikita Sobolev report at bugs.python.org
Mon Jan 17 09:57:56 EST 2022

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

Today I've noticed that these two methods are not covered: https://github.com/python/cpython/blame/16901c0482734dbd389b09ca3edfcf3e22faeed7/Lib/typing.py#L1028-L1032

- `typing._GenericAlias.__or__`
- `typing._GenericAlias.__ror__`

Later, I've realized that these two methods are not covered as well: https://github.com/python/cpython/blame/16901c0482734dbd389b09ca3edfcf3e22faeed7/Lib/typing.py#L1149-L1153

- `typing._SpecialGenericAlias.__or__`
- `typing._SpecialGenericAlias.__ror__`

My test plan is:
1. Cover regular `_GenericAlias` with `|` operation
2. Cover some `_SpecialGeneriAlias` instances like `Sized` and `Hashable`
3. Cover `Callable` and `Tuple` types, because they are a special-cased subtypes of `_SpecialGeneriAlias`

PR is on its way.

components: Tests
messages: 410792
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `__or__` is not covered for `_GenericAlias` and `_SpecialGenericAlias` in `typing`
type: behavior
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list