@@ -42,6 +42,35 @@ def test_keyword_args(self):
42
42
with self .assertRaisesRegex (TypeError , 'keyword argument' ):
43
43
tuple (sequence = ())
44
44
45
+ # TODO: RUSTPYTHON
46
+ @unittest .expectedFailure
47
+ def test_keywords_in_subclass (self ):
48
+ class subclass (tuple ):
49
+ pass
50
+ u = subclass ([1 , 2 ])
51
+ self .assertIs (type (u ), subclass )
52
+ self .assertEqual (list (u ), [1 , 2 ])
53
+ with self .assertRaises (TypeError ):
54
+ subclass (sequence = ())
55
+
56
+ class subclass_with_init (tuple ):
57
+ def __init__ (self , arg , newarg = None ):
58
+ self .newarg = newarg
59
+ u = subclass_with_init ([1 , 2 ], newarg = 3 )
60
+ self .assertIs (type (u ), subclass_with_init )
61
+ self .assertEqual (list (u ), [1 , 2 ])
62
+ self .assertEqual (u .newarg , 3 )
63
+
64
+ class subclass_with_new (tuple ):
65
+ def __new__ (cls , arg , newarg = None ):
66
+ self = super ().__new__ (cls , arg )
67
+ self .newarg = newarg
68
+ return self
69
+ u = subclass_with_new ([1 , 2 ], newarg = 3 )
70
+ self .assertIs (type (u ), subclass_with_new )
71
+ self .assertEqual (list (u ), [1 , 2 ])
72
+ self .assertEqual (u .newarg , 3 )
73
+
45
74
def test_truth (self ):
46
75
super ().test_truth ()
47
76
self .assertTrue (not ())
0 commit comments