diff options
author | Ran Benita <ran@unusedvar.com> | 2020-05-01 14:40:15 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-06-05 11:34:19 +0300 |
commit | ff8b7884e8f1019f60f270eab2c4909ff557dd4e (patch) | |
tree | acd646ed77e2623fc944a53ab7bc8525f0c865b0 /src/_pytest/compat.py | |
parent | 43fa1ee8f9e865319758617d6a1e15bf7eef972f (diff) | |
download | pytest-ff8b7884e8f1019f60f270eab2c4909ff557dd4e.tar.gz |
Type annotate ParameterSet
Diffstat (limited to 'src/_pytest/compat.py')
-rw-r--r-- | src/_pytest/compat.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 4cc22ba4a..84f9609a7 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -1,6 +1,7 @@ """ python version compatibility code """ +import enum import functools import inspect import os @@ -33,13 +34,20 @@ else: if TYPE_CHECKING: from typing import Type + from typing_extensions import Final _T = TypeVar("_T") _S = TypeVar("_S") -NOTSET = object() +# fmt: off +# Singleton type for NOTSET, as described in: +# https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions +class NotSetType(enum.Enum): + token = 0 +NOTSET = NotSetType.token # type: Final # noqa: E305 +# fmt: on MODULE_NOT_FOUND_ERROR = ( "ModuleNotFoundError" if sys.version_info[:2] >= (3, 6) else "ImportError" |