8000 typing __parameters__ __type_params__ by youknowone · Pull Request #5909 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

typing __parameters__ __type_params__ #5909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Lib/test/_typed_dict_helper.py

This file was deleted.

62 changes: 0 additions & 62 deletions Lib/test/ann_module.py

This file was deleted.

36 changes: 0 additions & 36 deletions Lib/test/ann_module2.py

This file was deleted.

18 changes: 0 additions & 18 deletions Lib/test/ann_module3.py

This file was deleted.

5 changes: 0 additions & 5 deletions Lib/test/ann_module4.py

This file was deleted.

10 changes: 0 additions & 10 deletions Lib/test/ann_module5.py

This file was deleted.

7 changes: 0 additions & 7 deletions Lib/test/ann_module6.py

This file was deleted.

11 changes: 0 additions & 11 deletions Lib/test/ann_module7.py

This file was deleted.

53 changes: 0 additions & 53 deletions Lib/test/mod_generics_cache.py

This file was deleted.

2 changes: 1 addition & 1 deletion Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def test_var_annot_module_semantics(self):
def test_var_annot_in_module(self):
# check that functions fail the same way when executed
# outside of module where they were defined
from test.ann_module3 import f_bad_ann, g_bad_ann, D_bad_ann
from test.typinganndata.ann_module3 import f_bad_ann, g_bad_ann, D_bad_ann
with self.assertRaises(NameError):
f_bad_ann()
with self.assertRaises(NameError):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_module/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def test_annotations_getset_raises(self):
del foo.__annotations__

def test_annotations_are_created_correctly(self):
ann_module4 = import_helper.import_fresh_module('test.ann_module4')
ann_module4 = import_helper.import_fresh_module('test.typinganndata.ann_module4')
self.assertTrue("__annotations__" in ann_module4.__dict__)
del ann_module4.__annotations__
self.assertFalse("__annotations__" in ann_module4.__dict__)
Expand Down
19 changes: 0 additions & 19 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,6 @@ def test_typevar(self):
class A(Generic[T]): ...
Alias = Optional[T]

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_typevar_none(self):
U = TypeVar('U')
U_None = TypeVar('U_None', default=None)
Expand Down Expand Up @@ -1210,8 +1208,6 @@ def foo(**kwargs: Unpack[Movie]): ...
self.assertEqual(repr(foo.__annotations__['kwargs']),
f"typing.Unpack[{__name__}.Movie]")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_builtin_tuple(self):
Ts = TypeVarTuple("Ts")

Expand Down Expand Up @@ -2636,11 +2632,6 @@ def test_consistency(self):
class CollectionsCallableTests(BaseCallableTests, BaseTestCase):
Callable = collections.abc.Callable

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_errors(self):
super().test_errors()


class LiteralTests(BaseTestCase):
def test_basics(self):
Expand Down Expand Up @@ -3608,8 +3599,6 @@ class C(B[int]):
c.bar = 'abc'
self.assertEqual(c.__dict__, {'bar': 'abc'})

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_setattr_exceptions(self):
class Immutable[T]:
def __setattr__(self, key, value):
Expand Down Expand Up @@ -3753,8 +3742,6 @@ class Meta(type): ...
self.assertEqual(Union[T, int][Meta], Union[Meta, int])
self.assertEqual(Callable[..., Meta].__args__, (Ellipsis, Meta))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_generic_hashes(self):
class A(Generic[T]):
...
Expand Down Expand Up @@ -4302,8 +4289,6 @@ class B(Generic[T]):
self.assertEqual(A[T], A[T])
self.assertNotEqual(A[T], B[T])

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_multiple_inheritance(self):

class A(Generic[T, VT]):
Expand Down Expand Up @@ -6106,8 +6091,6 @@ class C(Generic[T]): pass
self.assertIs(get_origin((*tuple[*Ts],)[0]), tuple)
self.assertIs(get_origin(Unpack[Tuple[Unpack[Ts]]]), Unpack)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_get_args(self):
T = TypeVar('T')
class C(Generic[T]): pass
Expand Down Expand Up @@ -7599,8 +7582,6 @@ class A[T](TypedDict):
self.assertEqual(A[str].__parameters__, ())
self.assertEqual(A[str].__args__, (str,))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_generic_inheritance(self):
class A(TypedDict, Generic[T]):
a: T
Expand Down
28 changes: 13 additions & 15 deletions Lib/test/typinganndata/mod_generics_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

from typing import TypeVar, Generic, Optional, TypeAliasType

# TODO: RUSTPYTHON
default_a: Optional['A'] = None
default_b: Optional['B'] = None

# default_a: Optional['A'] = None
# default_b: Optional['B'] = None
T = TypeVar('T')

# T = TypeVar('T')

class A(Generic[T]):
some_b: 'B'

# class A(Generic[T]):
# some_b: 'B'

class B(Generic[T]):
class A(Generic[T]):
pass

# class B(Generic[T]):
# class A(Generic[T]):
# pass
my_inner_a1: 'B.A'
my_inner_a2: A
my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__

# my_inner_a1: 'B.A'
# my_inner_a2: A
# my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__

# type Alias = int
# OldStyle = TypeAliasType("OldStyle", int)
type Alias = int
OldStyle = TypeAliasType("OldStyle", int)
Loading
Loading
0