mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Add some tests for PEP 604
This commit is contained in:
46
test/completion/pep0604.py
Normal file
46
test/completion/pep0604.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from pep0484_generic_parameters import list_t_to_list_t
|
||||
|
||||
list_of_ints_and_strs: list[int | str]
|
||||
|
||||
# Test that unions are handled
|
||||
x2 = list_t_to_list_t(list_of_ints_and_strs)[0]
|
||||
#? int() str()
|
||||
x2
|
||||
|
||||
for z in list_t_to_list_t(list_of_ints_and_strs):
|
||||
#? int() str()
|
||||
z
|
||||
|
||||
|
||||
from pep0484_generic_passthroughs import (
|
||||
typed_variadic_tuple_generic_passthrough,
|
||||
)
|
||||
|
||||
variadic_tuple_str_int: tuple[int | str, ...]
|
||||
|
||||
for m in typed_variadic_tuple_generic_passthrough(variadic_tuple_str_int):
|
||||
#? str() int()
|
||||
m
|
||||
|
||||
|
||||
def func_returns_byteslike() -> bytes | bytearray:
|
||||
pass
|
||||
|
||||
#? bytes() bytearray()
|
||||
func_returns_byteslike()
|
||||
|
||||
|
||||
pep604_opetional_1: int | str | None
|
||||
pep604_opetional_2: None | bytes
|
||||
|
||||
#? int() str() None
|
||||
pep604_opetional_1
|
||||
|
||||
#? None bytes()
|
||||
pep604_opetional_2
|
||||
|
||||
|
||||
pep604_in_str: "int | bytes"
|
||||
|
||||
#? int() bytes()
|
||||
pep604_in_str
|
||||
Reference in New Issue
Block a user