File tree 1 file changed +29
-0
lines changed 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -190,3 +190,32 @@ def test_isinstance_check():
190
190
for x in b :
191
191
assert isinstance (x , System .Object )
192
192
assert isinstance (x , System .String )
193
+
194
+ def test_clr_subclass_with_init_args ():
195
+ calls = []
196
+ class TestX (System .Object ):
197
+ __namespace__ = "test_clr_subclass_with_init_args"
198
+ def __init__ (self , * args , ** kwargs ):
199
+ calls .append ((args , kwargs ))
200
+ t = TestX (1 ,2 ,3 ,foo = "bar" )
201
+ assert len (calls ) == 1
202
+ assert calls [0 ][0 ] == (1 ,2 ,3 )
203
+ assert calls [0 ][1 ] == {"foo" :"bar" }
204
+
205
+ def test_clr_subclass_without_init_args ():
206
+ calls = []
207
+ class TestX (System .Object ):
208
+ __namespace__ = "test_clr_subclass_without_init_args"
209
+ def __init__ (self ):
210
+ calls .append (True )
211
+ t = TestX ()
212
+ assert len (calls ) == 1
213
+ assert calls [0 ] == True
214
+
215
+
216
+ def test_clr_subclass_without_init ():
217
+ class TestX (System .Object ):
218
+ __namespace__ = "test_clr_subclass_without_init"
219
+ q = 1
220
+ t = TestX ()
221
+ assert t .q == 1
You can’t perform that action at this time.
0 commit comments