Add tests for typing PEPs for Python 3.5...3.8#7
Add tests for typing PEPs for Python 3.5...3.8#7stinos merged 3 commits intostinos:builtintypingmodulefrom
Conversation
PEP 484 Type Hints Python 3.5 PEP 526 Syntax for Variable Annotations Python 3.6 PEP 544 Protocols: Structural subtyping (static duck typing) Python 3.8 PEP 560 Core support for typing module and generic types Python 3.7 PEP 586 Literal Types Python 3.8 PEP 589 TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys Python 3.8 PEP 591 Adding a final qualifier to typing Python 3.8 Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
…in typing alias specifications. Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
|
Pulling in these changes to check. Btw do these tests all pass with the typing implementation written in Python? |
yes they do, with the exclusion of the 'un-mutability' tests you added. Ans I also got collections.abc working by patching # optional collections.abc typing dummy module
try:
# cannot use relative import here
import collections.abc as abc
import sys
sys.modules['collections.abc'] = abc
except ImportError:
pass# collections.abc
# minimal support for runtime typing
# type: ignore
try:
from typing import __Ignore as ABC
from typing import __getattr__ as __getattr__
except ImportError:
pass#tests/.../typing_syntax.py
# if "micropython" in sys.implementation.name:
# # Verify assignment is not possible.
# try:
# typing.a = None
# raise Exception()
# except AttributeError:
# pass
# try:
# typing[0] = None
# raise Exception()
# except TypeError:
# pass
# try:
# List.a = None
# raise Exception()
# except AttributeError:
# pass |
|
Using CPython 3.13.7, the .exp for typing_pep_0589.py comes out as so looks like my CPython doesn't support that - do I need a different version? For typing_pep_0591, is there a FIXME missing in ? |
No its not that - While creating the tests I just worked my way up the versions until I hit 3.9. While PEP 589 is listed on https://peps.python.org/topic/typing/ as implemented in Python 3.8
Also MicroPython has no actual support for |
This should help provide clarity on what does / does not work.
This also includes an improvement to support standard container generics such as
List[int]