From 8581d9d26ae76ea3d5719bdd9a0e103bf79e1528 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Fri, 13 Jan 2023 10:20:49 +0100 Subject: Do not require typing_extensions on Python 3.11 19878a55e61ce8788db530240dba9570706a5aac added an unconditional dependency on typing_extensions to fix tests with Python 3.10 3.11. This commit fixes this issue by only requiring typing_extensions on Python versions lower than 3.11 and using standard typing on Python 3.11 and newer. --- tests/unittest_scoped_nodes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py index 39d21369..c59bdc3f 100644 --- a/tests/unittest_scoped_nodes.py +++ b/tests/unittest_scoped_nodes.py @@ -1907,11 +1907,14 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase): import typing import dataclasses - import typing_extensions + if sys.version_info >= (3, 8): + from typing import Protocol + else: + from typing_extensions import Protocol T = typing.TypeVar("T") - class MyProtocol(typing_extensions.Protocol): pass + class MyProtocol(Protocol): pass class EarlyBase(typing.Generic[T], MyProtocol): pass class Base(EarlyBase[T], abc.ABC): pass class Final(Base[object]): pass -- cgit v1.2.1