8000 fix tests · RustPython/RustPython@5a9e1c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a9e1c2

Browse files
committed
fix tests
1 parent 32e9adf commit 5a9e1c2

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

Lib/test/test_dataclasses.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,8 @@ def new_method(self):
19061906
c = Alias(10, 1.0)
19071907
self.assertEqual(c.new_method(), 1.0)
19081908

1909+
# TODO: RUSTPYTHON
1910+
@unittest.expectedFailure
19091911
def test_generic_dynamic(self):
19101912
T = TypeVar('T')
19111913

@@ -3250,6 +3252,8 @@ def test_classvar_module_level_import(self):
32503252
# won't exist on the instance.
32513253
self.assertNotIn('not_iv4', c.__dict__)
32523254

3255+
# TODO: RUSTPYTHON
3256+
@unittest.expectedFailure
32533257
def test_text_annotations(self):
32543258
from test import dataclass_textanno
32553259

Lib/test/test_fractions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,13 +617,17 @@ def testConversions(self):
617617

618618
self.assertTypedEquals(0.1+0j, complex(F(1,10)))
619619

620+
# TODO: RUSTPYTHON
621+
@unittest.expectedFailure
620622
def testSupportsInt(self):
621623
# See bpo-44547.
622624
f = F(3, 2)
623625
self.assertIsInstance(f, typing.SupportsInt)
624626
self.assertEqual(int(f), 1)
625627
self.assertEqual(type(int(f)), int)
626628

629+
# TODO: RUSTPYTHON
630+
@unittest.expectedFailure
627631
def testIntGuaranteesIntReturn(self):
628632
# Check that int(some_fraction) gives a result of exact type `int`
629633
# even if the fraction is using some other Integral type for its

Lib/test/test_genericalias.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def test_exposed_type(self):
173173
self.assertEqual(a.__args__, (int,))
174174
self.assertEqual(a.__parameters__, ())
175175

176+
# TODO: RUSTPYTHON
177+
@unittest.expectedFailure
176178
def test_parameters(self):
177179
from typing import List, Dict, Callable
178180
D0 = dict[str, int]
@@ -212,6 +214,8 @@ def test_parameters(self):
212214
self.assertEqual(L5.__args__, (Callable[[K, V], K],))
213215
self.assertEqual(L5.__parameters__, (K, V))
214216

217+
# TODO: RUSTPYTHON
218+
@unittest.expectedFailure
215219
def test_parameter_chaining(self):
216220
from typing import List, Dict, Union, Callable
217221
self.assertEqual(list[T][int], list[int])
@@ -271,6 +275,8 @@ class MyType(type):
271275
with self.assertRaises(TypeError):
272276
MyType[int]
273277

278+
# TODO: RUSTPYTHON
279+
@unittest.expectedFailure
274280
def test_pickle(self):
275281
alias = GenericAlias(list, T)
276282
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
@@ -280,6 +286,8 @@ def test_pickle(self):
280286
self.assertEqual(loaded.__args__, alias.__args__)
281287
self.assertEqual(loaded.__parameters__, alias.__parameters__)
282288

289+
# TODO: RUSTPYTHON
290+
@unittest.expectedFailure
283291
def test_copy(self):
284292
class X(list):
285293
def __copy__(self):
@@ -303,6 +311,8 @@ def test_union(self):
303311
self.assertEqual(a.__args__, (list[int], list[str]))
304312
self.assertEqual(a.__parameters__, ())
305313

314+
# TODO: RUSTPYTHON
315+
@unittest.expectedFailure
306316
def test_union_generic(self):
307317
a = typing.Union[list[T], tuple[T, ...]]
308318
self.assertEqual(a.__args__, (list[T], tuple[T, ...]))

Lib/test/test_types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ def test_instancecheck_and_subclasscheck(self):
742742
self.assertTrue(issubclass(dict, x))
743743
self.assertFalse(issubclass(list, x))
744744

745+
# TODO: RUSTPYTHON
746+
@unittest.expectedFailure
745747
def test_instancecheck_and_subclasscheck_order(self):
746748
T = typing.TypeVar('T')
747749

@@ -788,13 +790,17 @@ def __subclasscheck__(cls, sub):
788790
self.assertTrue(issubclass(int, x))
789791
self.assertRaises(ZeroDivisionError, issubclass, list, x)
790792

793+
# TODO: RUSTPYTHON
794+
@unittest.expectedFailure
791795
def test_or_type_operator_with_TypeVar(self):
792796
TV = typing.TypeVar('T')
793797
assert TV | str == typing.Union[TV, str]
794798
assert str | TV == typing.Union[str, TV]
795799
self.assertIs((int | TV)[int], int)
796800
self.assertIs((TV | int)[int], int)
797801

802+
# TODO: RUSTPYTHON
803+
@unittest.expectedFailure
798804
def test_union_args(self):
799805
def check(arg, expected):
800806
clear_typing_caches()
@@ -825,6 +831,8 @@ def check(arg, expected):
825831
check(x | None, (x, type(None)))
826832
check(None | x, (type(None), x))
827833

834+
# TODO: RUSTPYTHON
835+
@unittest.expectedFailure
828836
def test_union_parameter_chaining(self):
829837
T = typing.TypeVar("T")
830838
S = typing.TypeVar("S")
@@ -869,6 +877,8 @@ def eq(actual, expected, typed=True):
869877
eq(x[NT], int | NT | bytes)
870878
eq(x[S], int | S | bytes)
871879

880+
# TODO: RUSTPYTHON
881+
@unittest.expectedFailure
872882
def test_union_pickle(self):
873883
orig = list[T] | int
874884
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
@@ -878,19 +888,25 @@ def test_union_pickle(self):
878888
self.assertEqual(loaded.__args__, orig.__args__)
879889
self.assertEqual(loaded.__parameters__, orig.__parameters__)
880890

891+
# TODO: RUSTPYTHON
892+
@unittest.expectedFailure
881893
def test_union_copy(self):
882894
orig = list[T] | int
883895
for copied in (copy.copy(orig), copy.deepcopy(orig)):
884896
self.assertEqual(copied, orig)
885897
self.assertEqual(copied.__args__, orig.__args__)
886898
self.assertEqual(copied.__parameters__, orig.__parameters__)
887899

900+
# TODO: RUSTPYTHON
901+
@unittest.expectedFailure
888902
def test_union_parameter_substitution_errors(self):
889903
T = typing.TypeVar("T")
890904
x = int | T
891905
with self.assertRaises(TypeError):
892906
x[int, str]
893907

908+
# TODO: RUSTPYTHON
909+
@unittest.expectedFailure
894910
def test_or_type_operator_with_forward(self):
895911
T = typing.TypeVar('T')
896912
ForwardAfter = T | 'Forward'

0 commit comments

Comments
 (0)
0