summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBas van Beek <43369155+BvB93@users.noreply.github.com>2020-09-22 15:55:34 (GMT)
committerGitHub <noreply@github.com>2020-09-22 15:55:34 (GMT)
commit0d0e9fe2ffc1683758a1985ef6dedeef5ecafdbc (patch)
tree6b8cf4e733d804aaf7f841c0d37d48edff7b710d /Lib
parenta68a2ad19c891faa891904b3da537911cc77df21 (diff)
downloadcpython-0d0e9fe2ffc1683758a1985ef6dedeef5ecafdbc.zip
cpython-0d0e9fe2ffc1683758a1985ef6dedeef5ecafdbc.tar.gz
cpython-0d0e9fe2ffc1683758a1985ef6dedeef5ecafdbc.tar.bz2
bpo-41810: Reintroduce `types.EllipsisType`, `.NoneType` & `.NotImplementedType` (GH-22336)
closes issue 41810
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_types.py10
-rw-r--r--Lib/types.py3
2 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index f499fb9..52a59d5 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -713,6 +713,16 @@ class TypesTests(unittest.TestCase):
assert repr(int | None) == "int | None"
assert repr(int | typing.GenericAlias(list, int)) == "int | list[int]"
+ def test_ellipsis_type(self):
+ self.assertIsInstance(Ellipsis, types.EllipsisType)
+
+ def test_notimplemented_type(self):
+ self.assertIsInstance(NotImplemented, types.NotImplementedType)
+
+ def test_none_type(self):
+ self.assertIsInstance(None, types.NoneType)
+
+
class MappingProxyTests(unittest.TestCase):
mappingproxy = types.MappingProxyType
diff --git a/Lib/types.py b/Lib/types.py
index 9642e72..532f480 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -296,5 +296,8 @@ def coroutine(func):
GenericAlias = type(list[int])
Union = type(int | str)
+EllipsisType = type(Ellipsis)
+NoneType = type(None)
+NotImplementedType = type(NotImplemented)
__all__ = [n for n in globals() if n[:1] != '_']